发送SOAP 1.2

3
我需要使用SOAP向服务器发送一些数据。我已经实现了这个功能,但是出现了一个错误。
这个错误不是SOAP或PHP等错误,而是他们的应用程序协议的错误结果。
对方坚持认为这是因为我正在发送SOAP1.1数据,而他们需要SOAP1.2。据我所知,我正在发送1.2。
为了检查,我在我的服务器上创建了一个简单的页面来收集标头和数据,以便我可以看到实际发送的内容。
我是否遗漏了什么?或者根据我下面发送的内容,这实际上是我怀疑的SOAP1.2吗?
PS,我查看了这篇文章以获取更多有关差异的信息:http://wso2.com/library/articles/differentiating-between-soap-versions-looking-soap-message/ 非常感谢,
约翰
标头:
SERVER: Array
(
    [CONTENT_LENGTH] => 1286
    [CONTENT_TYPE] => application/soap+xml; charset=utf-8
    [DOCUMENT_ROOT] => /home/viewport/public_html
    [GATEWAY_INTERFACE] => CGI/1.1
    [GEOIP_ADDR] => 1.2.3.4
    [HTTP_ACCEPT] => */*
    [HTTP_EXPECT] => 100-continue
    [HTTP_HOST] => example.com
    [PATH] => /bin
    [QUERY_STRING] => 
    [REDIRECT_STATUS] => 200
    [REMOTE_ADDR] => 1.2.3.4
    [REMOTE_PORT] => 46608
    [REQUEST_METHOD] => POST
    [REQUEST_URI] => /soap/index.php
    [SCRIPT_FILENAME] => /home/example/public_html/soap/index.php
    [SCRIPT_NAME] => /soap/index.php
    [SERVER_ADDR] => 11.1.1.1
    [SERVER_ADMIN] => root@localhost
    [SERVER_NAME] => example.com
    [SERVER_PORT] => 80
    [SERVER_PROTOCOL] => HTTP/1.1
    [SERVER_SIGNATURE] => 
    [SERVER_SOFTWARE] => Apache
    [UNIQUE_ID] => WASuooHowGwAAFv9EK4AAAAB
    [PHP_SELF] => /soap/index.php
    [REQUEST_TIME] => 1476701858
)

以及数据:

xml: <?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>
<EditionContactCustomer xmlns="http://tempuri.org/">
<Title>Spares</Title>
<FirstName>John</FirstName>
<Surname>Mc</Surname>
<AddressLine1></AddressLine1>
<PostTown>plett</PostTown>
<County>Western Cape</County>
<PostCode></PostCode>
<email>john@example.com</email>
<TelephoneNumber>081</TelephoneNumber>
<MobileNumber>081</MobileNumber>
<WorkTelephoneNumber></WorkTelephoneNumber>
<Notes>this is a test note.</Notes>
<ContactDate>2016-10-17</ContactDate>
<ContactTime>10:57:38</ContactTime>
<VehicleRecordID></VehicleRecordID>
<IntroductionSource>Existing</IntroductionSource>
<EnquirySource>WEB</EnquirySource>
<EnquiryType>WEB_FORM</EnquiryType>
<GUID></GUID>
<ReferenceID></ReferenceID>
<UserName></UserName>
<LinkUrl></LinkUrl>
<ImageData></ImageData>
</EditionContactCustomer>
</soap12:Body>
</soap12:Envelope>

你的实际 PHP 代码是什么? - GunniH
抱歉,我忘了提到我实际上没有使用SOAP客户端。我只是创建XML,然后使用curl进行发布。上面的输出是curl发布的结果。 - John Mc Murray
但是.......为什么? - GunniH
1个回答

0

要正确发送SOAP 1.2,您需要在SoapClient构造中使用正确的“soap_version”参数。

$client = new SoapClient($url, array(
    "soap_version"      => SOAP_1_2,
    "login"             => "username",
    "password"          => "password"
));

其中 $url 为您的 WSDL 位置,可以是在线或 file://


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接