2009-04-10 127 views

回答

40

SOAP 1.1使用命名空间http://schemas.xmlsoap.org/wsdl/soap/

SOAP 1.2使用命名空间http://schemas.xmlsoap.org/wsdl/soap12/

的WSDL是能够在相同的wsdl同时,以限定下皂1.1和1.2肥皂操作。如果您需要发展您的wsdl以支持需要soap 1.2的新功能(例如MTOM),那么这非常有用,在这种情况下,您不需要创建新服务,只需要改进原来的服务即可。

+1

MTOM可以与soap1.1一起使用 – GregD 2015-03-04 10:02:32

4

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

看看Demo web service WSDL。它具有对soap12名称空间的引用,表明它支持SOAP 1.2。如果没有,那么假设该服务仅支持SOAP 1.1,则可能是安全的。

+0

soap12命名空间参考是一个很好的指标。但是如果它丢失了,它仍然可以是一个SOAP 1.2 Web服务 - http://en.wikipedia.org/wiki/Web_Services_Description_Language中的示例WSDL没有这个引用,但它可能包含其他一些典型的SOAP 1.2? – mjn 2009-04-10 06:41:08

2

找到binding-element中的transport-attribute,它告诉我们这是SOAP 1.1 HTTP绑定的WSDL 1.1绑定。

ex。

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
18

在WSDL中,如果您查看绑定部分,您将清楚地看到,如果服务使用soap 1.2,则会明确提到肥皂绑定。请参阅下面的示例。

<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> 

如果Web服务使用soap 1.1,它不会在绑定部分下显式定义WSDL文件中的任何soap版本。请参阅下面的示例。

<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> 

如何确定SOAP消息的SOAP版本?

但请记住,这不是推荐的方式来确定您的Web服务使用的肥皂版本。肥皂消息的版本可以使用以下方法之一来确定。

1.检查SOAP消息

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

SOAP 1.2 namespace : http://www.w3.org/2003/05/soap-envelope 

2.检查SOAP消息

SOAP 1的传输绑定信息(HTTP头信息)的命名空间。1:用户文本/ XML的上下文类型

POST /MyService HTTP/1.1 
    Content-Type: text/xml; charset="utf-8" 
    Content-Length: xxx 
    SOAPAction: "urn:uuid:myaction" 

SOAP 1.2:使用用户应用程序/肥皂+ xml的用于上下文类型

POST /MyService HTTP/1.1 
    Content-Type: application/soap+xml; charset="utf-8" 
    Content-Length: xxx 
    SOAPAction: "urn:uuid:myaction" 

3. SOAP故障信息

两个版本之间的SOAP错误消息的结构不同。

+5

答案的第一部分可以使用一些附加信息 - “soap12”是命名空间前缀,而不是命名空间本身。您需要检查“soap12”前缀所解析的内容以及指定的soap版本。有人可以使用soap12作为前缀,但指向soap11名称空间URI。 – csadler 2016-05-12 14:37:35

相关问题