【问题标题】:Does this WSDL support Soap 1.1 AND Soap1.2?此 WSDL 是否支持 Soap 1.1 和 Soap1.2?
【发布时间】:2018-02-15 01:34:24
【问题描述】:

这里是WSDL

在绑定部分,它包括:

<wsdl:operation name="SubmitPurchaseOrder">
<soap:operation soapAction="http://tempuri.org/IEBusinessService/SubmitPurchaseOrder" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

还包括:

<wsdl:operation name="SubmitPurchaseOrder">
<soap12:operation soapAction="http://tempuri.org/IEBusinessService/SubmitPurchaseOrder" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>

但是,当我尝试与 'soap_version' =&gt; SOAP_1_1 连接时,我收到了预期的错误 type 'application/soap+xml; charset=utf-8'

【问题讨论】:

    标签: php web-services soap wsdl soap-client


    【解决方案1】:

    SOAP 1.2 和 SOAP 1.1 之间有 3 个主要区别

    1. SOAP 1.2 使用“application/soap+xml”作为 Content-Type 和 SOAP 1.1 使用“文本/xml”。
    2. SOAP 1.2 不使用 SOAPAction 标题行。

    3. SOAP 1.2 使用“http://www.w3.org/2003/05/soap-envelope”作为信封命名空间,而 SOAP 1.1 使用 “http://schemas.xmlsoap.org/soap/envelope/”。

    我从资源中得到的很好的例子:http://www.herongyang.com/Web-Services/Perl-SOAP-1-2-Request-Differences-SOAP-1-1-and-1-2.html 在下面

    SOAP 1.1 request: 
    
    POST /WSShakespeare.asmx HTTP/1.1
    Host: www.xmlme.com
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    SOAPAction: "http://xmlme.com/WebServices/GetSpeech"
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <GetSpeech xmlns="http://xmlme.com/WebServices">
          <Request>string</Request>
        </GetSpeech>
      </soap:Body>
    </soap:Envelope>
    
    
    SOAP 1.2 request:
    
    POST /WSShakespeare.asmx HTTP/1.1
    Host: www.xmlme.com
    Content-Type: application/soap+xml; charset=utf-8
    Content-Length: length
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
      <soap12:Body>
        <GetSpeech xmlns="http://xmlme.com/WebServices">
          <Request>string</Request>
        </GetSpeech>
      </soap12:Body>
    </soap12:Envelope>
    

    【讨论】:

    • 我了解 Soap 请求中的差异。我在问给出的 WSDL 文件是否指示使用 Soap 1.2 还是 Soap 1.1?它似乎同时支持两者,但我不确定。
    • 看起来你的问题重复了这个问题:stackoverflow.com/questions/736845/… WSDL 支持两个版本的soap,而且它可以在同一个wsdl 中同时支持这两个版本
    【解决方案2】:

    回答我自己的问题

    WSDL 文件可以指示在同一个文件中同时支持 SOAP 1.1 和 1.2。您可以指定要使用的绑定:

    SoapClient::__setLocation()

    http://php.net/manual/en/soapclient.setlocation.php

    WsHttpBinding

    $client->__setLocation('https://api.krollcorp.com/EBusinessTest/Kroll.Dealer.EBusiness.svc/')
    

    基本HttpBinding

    $client->__setLocation('https://api.krollcorp.com/EBusinessTest/Kroll.Dealer.EBusiness.svc/Basic')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-21
      • 2021-05-14
      • 1970-01-01
      • 2011-07-21
      • 2015-12-15
      • 2017-07-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多