Web 服务是否同时支持 SOAP 1.1 和 1.2
Can both SOAP 1.1 and 1.2 supported by a web service
查看以下来自 wsdl 的片段 -
<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 使用的版本吗?
非常感谢您的宝贵时间。
对于第一个问题,您需要查看 WSDL 文件,看看在哪里使用了 soap12
命名空间前缀。您应该会找到 <soap12:binding>
、<soap12:operation>
、<soap12:address>
等
在 WSDL 中声明一个 SOAP 1.2 命名空间是不够的,您需要在该命名空间中声明 XML 个元素才能在某些方面发挥作用。如果您没有 soap12
命名空间前缀的绑定和地址,那么您的服务可能不支持它。
关于你的第二个问题,WSDL版本与SOAP协议版本不匹配。您可以使用带有 SOAP 1.1 的 WSDL 1.1 和 SOAP 1.2 的绑定扩展,也可以使用带有 SOAP 1.1 和 SOAP 1.2 的 WSDL 2.0。
您应该将 WSDL 提供给 SoapUI 并查看它允许您调用服务的方式有多少(在 SOAP 1.1 上或在 SOAP 1.1 和 SOAP 1.2 上)。
查看以下来自 wsdl 的片段 -
<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 使用的版本吗?
非常感谢您的宝贵时间。
对于第一个问题,您需要查看 WSDL 文件,看看在哪里使用了 soap12
命名空间前缀。您应该会找到 <soap12:binding>
、<soap12:operation>
、<soap12:address>
等
在 WSDL 中声明一个 SOAP 1.2 命名空间是不够的,您需要在该命名空间中声明 XML 个元素才能在某些方面发挥作用。如果您没有 soap12
命名空间前缀的绑定和地址,那么您的服务可能不支持它。
关于你的第二个问题,WSDL版本与SOAP协议版本不匹配。您可以使用带有 SOAP 1.1 的 WSDL 1.1 和 SOAP 1.2 的绑定扩展,也可以使用带有 SOAP 1.1 和 SOAP 1.2 的 WSDL 2.0。
您应该将 WSDL 提供给 SoapUI 并查看它允许您调用服务的方式有多少(在 SOAP 1.1 上或在 SOAP 1.1 和 SOAP 1.2 上)。