首页 文章

WSDL可以指示Web服务的SOAP版本(1.1或1.2)吗?

提问于
浏览
58

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

5 回答

  • 13

    是的,您通常可以根据WSDL查看支持的SOAP版本 .

    看看Demo web service WSDL . 它引用了soap12名称空间,表明它支持SOAP 1.2 . 如果没有,那么假设该服务仅支持SOAP 1.1,您可能会安全 .

  • 2

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

    恩 .

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

    我找到了这个页面

    http://schemas.xmlsoap.org/wsdl/soap12/soap12WSDL.htm

    其中说Soap 1.2使用新的命名空间http://schemas.xmlsoap.org/wsdl/soap12/

    它位于'SOAP 1.1的WSDL 1.1绑定扩展中' .

  • 50

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

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

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

  • 27

    在WSDL中,如果查看 Binding 部分,如果服务使用soap 1.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>
    

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

    How to determine the SOAP version of the SOAP message?

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

    1. checking the namespace of the soap message

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

    2. checking the transport binding information (http header information) of the soap message

    SOAP 1.1:Context-Type的用户text / xml

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

    SOAP 1.2:Context-Type的用户应用程序/ soap xml

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

    3. using SOAP fault information

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

相关问题