soap - 在 SOAP 中向现有输出数据类型添加新字段的变通方法

标签 soap jax-ws

根据 this article about backwards compatibility in SOAP by IBM,他们声明在不违反契约(Contract)的情况下不能将新字段添加到输出类型。页面中的相关片段来自标题为现有数据类型中的新可选字段的部分...

You can add an element to an existing complexType as long as you make it optional (using the minOccurs="0" attribute). But be careful. Adding an optional element is a minor change only if its enclosing complexType is received as input to the new service. The new service cannot return a complexType with new fields. If an old client were to receive the new field, the client deserialization would fail because the client would not know about the new field.



这是 2004 年为 WSDL 1.1 规范编写的。在当前的 WSDL 1.2 规范下,这仍然是真的吗?有没有办法为新的未知字段定义“忽略”的默认行为?该声明似乎也特定于实现还是符合规范?

我正在努力解决演化返回复杂业务对象的 SOAP 服务的问题。随着消费者为他们找到用例,将添加新字段。我想避免为了简单地添加新字段而保留 N 个版本的服务。

最佳答案

从我个人的经验来看,情况仍然如此。我认为您主要关心的是版本控制方法。你可以看看: http://www.ibm.com/developerworks/webservices/library/ws-version/ ,或者离家更近的 Web Services API Versioning

关于soap - 在 SOAP 中向现有输出数据类型添加新字段的变通方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14988786/

相关文章:

java - 使用 XSLT 2 在线替换部分字符串

Java网络服务: User defined meta-data

java - Gentoo Linux 下运行的 IntelliJ IDEA 中的 Web 服务支持

java - JAXB 生成的可使用 JAX-WS 绑定(bind)序列化的类

java - WSDL 缺少数据类型定义

soap - Exchange EWS 未返回日历的邮件正文

java - 在 Spring-Boot 中为 soap webservice 抛出自定义异常?

web-services - 贾克斯WS : Externalize Http Conduit name Attribute

web-services - 用于传输对象数据的流式、异步、语言独立技术

java - 如果 JAXWS 出现异常,如何发送自定义响应消息而不是故障消息?