【问题标题】:Can both SOAP 1.1 and 1.2 supported by a web serviceWeb 服务能否同时支持 SOAP 1.1 和 1.2
【发布时间】:2021-05-14 11:24:49
【问题描述】:

从wsdl看下面的sn-p-

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"    
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:tns="http://tempuri.org/" 
xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
name="XXXService" targetNamespace="http://tempuri.org/">

我有这些问题-

  • 因为上面的定义包括 -
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"

    我可以肯定地说 SOAP 1.1 和 1.2 都受支持吗?或
    我是否需要查看服务代码或 wsdl 的任何其他部分来确认 这个?

  • 另一个问题是,当我们谈论 WSDL 版本时 - 它总是与 SOAP 版本相同吗?
    那么 WSDL 版本 1.1 将是 SOAP 1.1 使用的版本吗?

非常感谢您的宝贵时间。

【问题讨论】:

    标签: soap wsdl


    【解决方案1】:

    对于第一个问题,您需要查看 WSDL 文件内部并查看在何处使用了 soap12 命名空间前缀。您应该找到类似&lt;soap12:binding&gt;&lt;soap12:operation&gt;&lt;soap12:address&gt; 等的内容。

    在 WSDL 中声明一个 SOAP 1.2 命名空间是不够的,您需要在该命名空间中声明 XML 元素才能使其在某些方面有用。如果您没有 soap12 命名空间前缀的绑定和地址,那么您的服务可能不支持它。

    对于第二个问题,WSDL 版本与 SOAP 协议版本不匹配。您可以将 WSDL 1.1 与 SOAP 1.1 以及 SOAP 1.2 的绑定扩展一起使用,并且您可以将 WSDL 2.0 与 SOAP 1.1 和 SOAP 1.2 一起使用。

    您应该将您的 WSDL 提供给 SoapUI,并查看它允许您调用服务的方式(在 SOAP 1.1 上或在 SOAP 1.1 和 SOAP 1.2 上)。

    【讨论】:

    • 非常感谢您的回复。 soap12 仅在 中使用,所以我的第一个疑问得到了排序。对于第二个 - 我安装了 SoapUI(5.5),如何为特定的 SOAP 版本调用服务 - 是否有任何设置?
    • 如果在绑定中没有使用soap12 前缀,那么这意味着您只能使用SOAP 1.1 调用该服务。当您使用 WSDL 在 SoapUI 中创建项目时,SoapUI 会为您的所有绑定创建操作。如果服务只公开 SOAP 1.1,那么您有一组操作。如果它还公开了 SOAP 1.2,那么 SoapUI 会创建两组操作。您不需要设置,因为 SoapUI 会创建所有设置。但是,如果您只有一个 SOAP 1.1 绑定,那么您只能得到那个集合。
    • 再次感谢,但我该如何澄清 WSDL 版本?
    • 您有一个 WSDL 1.1,因为根元素是 &lt;definitions&gt;。对于 WSDL 2.0,根元素称为 &lt;description&gt;。请参阅此图片了解差异:upload.wikimedia.org/wikipedia/commons/c/c2/WSDL_11vs20.png
    • 能否请您使用 WSDL 版本图像回复另一个 SO 问题 - 将帮助其他人寻找类似答案 - stackoverflow.com/questions/66155090/how-to-find-wsdl-version
    猜你喜欢
    • 2015-04-15
    • 2012-11-15
    • 1970-01-01
    • 2010-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-15
    相关资源
    最近更新 更多