此 WSDL 是否支持 Soap 1.1 和 Soap1.2?
Does this WSDL support Soap 1.1 AND Soap1.2?
这是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' => SOAP_1_1
时,我得到了预期的错误 type 'application/soap+xml; charset=utf-8'
SOAP 1.2 和 SOAP 1.1 之间有 3 个主要区别
- SOAP 1.2 使用 "application/soap+xml" 作为 Content-Type 和 SOAP 1.1
使用 "text/xml".
SOAP 1.2 不使用 SOAPAction header 行。
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>
回答我自己的问题
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')
这是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' => SOAP_1_1
时,我得到了预期的错误 type 'application/soap+xml; charset=utf-8'
SOAP 1.2 和 SOAP 1.1 之间有 3 个主要区别
- SOAP 1.2 使用 "application/soap+xml" 作为 Content-Type 和 SOAP 1.1 使用 "text/xml".
SOAP 1.2 不使用 SOAPAction header 行。
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>
回答我自己的问题
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')