Web services WSDL能否指示web服务的SOAP版本(1.1或1.2)?

Web services WSDL能否指示web服务的SOAP版本(1.1或1.2)?,web-services,soap,wsdl,Web Services,Soap,Wsdl,是否可以根据WSDL中的信息查看web服务是否使用SOAP 1.1或1.2?是的,您通常可以看到基于WSDL支持的SOAP版本 看一看。它有一个对soap12命名空间的引用,表示它支持SOAP1.2。如果没有这一点,那么假设该服务只支持SOAP1.1,您可能就安全了。我找到了这个页面 这说明SOAP1.2使用了新的名称空间 它位于“用于SOAP 1.1的WSDL 1.1绑定扩展”中。在绑定元素中找到传输属性,该属性告诉我们这是用于SOAP 1.1 HTTP绑定的WSDL 1.1绑定 前 SO

是否可以根据WSDL中的信息查看web服务是否使用SOAP 1.1或1.2?

是的,您通常可以看到基于WSDL支持的SOAP版本

看一看。它有一个对soap12命名空间的引用,表示它支持SOAP1.2。如果没有这一点,那么假设该服务只支持SOAP1.1,您可能就安全了。

我找到了这个页面

这说明SOAP1.2使用了新的名称空间


它位于“用于SOAP 1.1的WSDL 1.1绑定扩展”中。

在绑定元素中找到传输属性,该属性告诉我们这是用于SOAP 1.1 HTTP绑定的WSDL 1.1绑定


SOAP1.1使用名称空间

SOAP1.2使用名称空间


wsdl能够在同一wsdl中同时定义soap 1.1和soap 1.2下的操作。如果您需要改进您的wsdl以支持需要soap 1.2(例如MTOM)的新功能,那么这很有用。在这种情况下,您不需要创建新服务,只需改进原始服务。

在wsdl中,如果您查看绑定部分,您将清楚地看到,如果服务使用SOAP1.2,则会明确提到soap绑定。参考下面的示例

<binding name="EmployeeServiceImplPortBinding" type="tns:EmployeeServiceImpl">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="findEmployeeById">
    <soap12:operation soapAction=""/>
    <input><soap12:body use="literal"/></input>
    <output><soap12:body use="literal"/></output>
</operation><operation name="create">
    <soap12:operation soapAction=""/>
    <input><soap12:body use="literal"/></input>
    <output><soap12:body use="literal"/></output>
</operation>
</binding>
<binding name="EmployeeServiceImplPortBinding" type="tns:EmployeeServiceImpl">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="findEmployeeById">
    <soap:operation soapAction=""/>
    <input><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></input>
    <output><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></output>
</operation><operation name="create">
    <soap:operation soapAction=""/>
    <input><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></input>
    <output><soap:body use="literal" namespace="http://jaxb.ws.jax.samples.chathurangaonline.com/"/></output>
</operation>
</binding>
2。检查soap消息的传输绑定信息(http头信息)

SOAP 1.1  namespace : http://schemas.xmlsoap.org/soap/envelope

SOAP 1.2 namespace  : http://www.w3.org/2003/05/soap-envelope
SOAP1.1:上下文类型的用户文本/xml

   POST /MyService HTTP/1.1
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxx
   SOAPAction: "urn:uuid:myaction"
   POST /MyService HTTP/1.1
   Content-Type: application/soap+xml; charset="utf-8"
   Content-Length: xxx
   SOAPAction: "urn:uuid:myaction"
SOAP1.2:上下文类型的用户应用程序/SOAP+xml

   POST /MyService HTTP/1.1
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxx
   SOAPAction: "urn:uuid:myaction"
   POST /MyService HTTP/1.1
   Content-Type: application/soap+xml; charset="utf-8"
   Content-Length: xxx
   SOAPAction: "urn:uuid:myaction"
3。使用SOAP故障信息


两个版本之间的SOAP故障消息的结构不同

soap12命名空间引用是一个很好的指示器。但是,如果缺少它,它仍然可以是SOAP 1.2 web服务-als的示例WSDL没有此引用,但可能它包含SOAP 1.2中典型的其他内容?MTOM可以与SOAP 1一起使用。1答案的第一部分可以使用一些附加信息-“soap12”是名称空间前缀,而不是名称空间本身。您需要检查“soap12”前缀解析为什么,以及指定哪个版本的soap。有人可以使用soap12作为前缀,但指向soap11命名空间URI。谢谢,这非常有用。@csadler的注释非常重要,但即使在这里,也没有提供正确的命名空间值。给你。引用1.1的
soap
前缀是
http://schemas.xmlsoap.org/wsdl/soap/
。引用1.2的
soap12
前缀是
http://schemas.xmlsoap.org/wsdl/soap12/
。不管前缀名是什么(甚至可以是
foo
bar
),只要看看它解析的名称空间就知道了。