这个WSDL是否支持Soap 1.1和Soap1.2?

时间:2017-09-06 14:01:23

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

以下是WSDL

在Binding部分,它包括:

<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' => SOAP_1_1建立联系时,我收到的错误是type 'application/soap+xml; charset=utf-8'

2 个答案:

答案 0 :(得分:1)

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

  1. SOAP 1.2使用&#34; application / soap + xml&#34;作为Content-Type和SOAP 1.1 使用&#34; text / xml&#34;。
  2. SOAP 1.2不使用SOAPAction标题行。

  3. SOAP 1.2使用&#34; http://www.w3.org/2003/05/soap-envelope&#34;作为信封名称空间和SOAP 1.1使用 &#34; http://schemas.xmlsoap.org/soap/envelope/&#34;

  4. 我从资源获得的好例子: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>
    

答案 1 :(得分:0)

回答我自己的问题

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/')

<强> basicHttpBinding的

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