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

Difference between SOAP binding and HTTP Binding in WSDL

我正在使用具有两个端口的 WSDL - 一个具有 soap 绑定,另一个具有 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>

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

one having soap binding and the other one having HTTP binding

SOAP 绑定 SOAP 绑定定义了 SOAP XML 格式,这意味着 request/response XML 必须是什么样子以及它应该包含什么 XML nodes/namespaces 等?

HTTP 绑定

这里讨论的是 SOAP XMLs/Messages 应该如何传输,即在这种情况下它是否会传输 HTTP/HTTPS。

From what I know, SOAP is a protocol for messaging but still uses HTTP as transport protocol. Then what is the difference between using these two ports?

大多数情况下,传输协议是 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