WSDL 中 SOAP 绑定和 HTTP 绑定之间的区别

man*_*esh 5 soap wsdl http

我使用的 WSDL 有两个端口 - 一个具有肥皂绑定,另一个具有 HTTP 绑定。据我所知,SOAP 是一种消息传递协议,但仍然使用 HTTP 作为传输协议。那么这两个端口的使用有什么区别呢?

包含绑定和服务的 WSDL 部分:

<wsdl:binding name="OperationServiceNextGenHttpBinding" type="tns:OperationServiceNextGenPort">

    <http:binding verb="POST"/>
    <wsdl:operation name="operation">

        <http:operation location="/operation"/>
        <wsdl:input>
            <mime:content type="application/x-www-form-urlencoded"/>


        </wsdl:input>
        <wsdl:output>
            <mime:content type="text/xml"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:binding name="OperationServiceNextGenSOAPBinding" type="tns:OperationServiceNextGenPort">

    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="operation">

        <soap:operation soapAction="http://some.schema.com/marketplace/search/v1/services/operation"/>
        <wsdl:input>

            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>

            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="OperationServiceNextGen">
    <wsdl:documentation>
        <version>1.1.10</version>
    </wsdl:documentation>
    <wsdl:port binding="tns:OperationServiceNextGenHttpBinding" name="OperationServiceNextGenHttpPort">
        <http:address location="https://svcs.ebay.com/services/search/v1/OperationServiceNextGen"/>
    </wsdl:port>
    <wsdl:port binding="tns:OperationServiceNextGenSOAPBinding" name="OperationServiceNextGenSOAPPort">
        <soap12:address location="https://svcs.ebay.com/services/search/v1/OperationServiceNextGen"/>
    </wsdl:port>

</wsdl:service>
Run Code Online (Sandbox Code Playgroud)

Red*_*Boy 3

让我尝试简短地解释一下。

一个具有肥皂绑定,另一个具有 HTTP 绑定

SOAP 绑定 SOAP 绑定定义了 SOAP XML 格式,这意味着请求/响应 XML 必须是什么样子,以及它应该包含哪些 XML 节点/命名空间等?

HTTP 绑定

这讨论了 SOAP XML/消息应如何传输,即在本例中是否通过 HTTP/HTTPS 传输。

据我所知,SOAP 是一种消息传递协议,但仍然使用 HTTP 作为传输协议。那么这两个端口的使用有什么区别呢?

大多数情况下,传输协议是 HTTP/HTTPS,但情况可能并非总是如此,SOAP 可以通过 SMTP 或 FTP 进行传输。

请参阅 SOAP over SMTP 的更多信息。 https://teaching.shu.ac.uk/aces/ict/de/web_services/soap_over_http.htm# https://www.tutorialspoint.com/wsdl/wsdl_binding.htm