基于WSDL创建OSB代理服务时,如何切换为SOAP 1.2版本
Hey Anil, 我来帮你解决把OSB代理服务从默认的SOAP 1.1切换到1.2的问题。因为你的WSDL里没指定SOAP版本,所以得从修改WSDL文件和调整OSB控制台配置两个方面入手,具体步骤如下:
第一步:更新WSDL的绑定与端口定义
既然你的WSDL绑定层和端口层都没SOAP版本信息,我们需要手动添加SOAP 1.2的命名空间并替换相关绑定节点:
- 首先在WSDL的
<definitions>根标签里加入SOAP 1.2的命名空间:<definitions ... xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" ...> - 接着修改
<binding>节点,把原有的SOAP 1.1绑定替换为SOAP 1.2格式。比如原来的绑定可能是这样:
替换成SOAP 1.2的版本:<binding name="YourServiceBinding" type="tns:YourPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="YourOperation"> <soap:operation soapAction="http://your-namespace/YourOperation"/> <input><soap:body use="literal"/></input> <output><soap:body use="literal"/></output> </operation> </binding><binding name="YourServiceBinding" type="tns:YourPortType"> <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="YourOperation"> <soap12:operation soapAction="http://your-namespace/YourOperation"/> <input><soap12:body use="literal"/></input> <output><soap12:body use="literal"/></output> </operation> </binding> - 最后修改
<port>节点,把<soap:address>换成<soap12:address>:<port name="YourServicePort" binding="tns:YourServiceBinding"> <soap12:address location="http://your-service-endpoint-url"/> </port>
第二步:在OSB控制台更新代理服务
WSDL修改完成后,回到OSB控制台做以下操作:
- 找到你已创建的代理服务,进入编辑模式。
- 切换到「WSDL」选项卡,重新上传修改后的WSDL文件;如果是引用远程WSDL,确保引用路径指向更新后的文件。
- 检查「协议」或「消息流」配置区域,确认系统已自动识别SOAP 1.2版本。如果没自动识别,手动在协议设置里选择SOAP 1.2。
- 保存并激活你的配置变更。
验证配置是否生效
- 发送测试请求时,记得使用SOAP 1.2的Content-Type:
application/soap+xml(SOAP 1.1用的是text/xml)。 - 查看OSB的运行日志,确认没有版本不兼容的报错信息。
内容的提问来源于stack exchange,提问作者Anil
相关产品推荐
相关产品推荐

