gpt4 book ai didi

php - 发送 SOAP 1.2

转载 作者:行者123 更新时间:2023-12-05 07:47:05 25 4
gpt4 key购买 nike

我必须使用 SOAP 将一些数据发送到服务器。我已经实现了这个,但是我收到了一个错误。

错误不是 SOAP 或 PHP 等错误,而是它们的应用程序协议(protocol)内容导致的错误。

对方坚持认为这是因为我发送的是 SOAP1.1 数据,而他们需要 SOAP1.2。据我所知,我正在发送 1.2。

为了检查,我在我的服务器上创建了一个简单的页面来收集 header 和数据,这样我就可以看到实际发送的内容。

我是否遗漏了什么,或者根据我在下面发送的内容,我怀疑这实际上是 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>

最佳答案

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

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

$url 是您的 WSDL 位置,online 或 file://

关于php - 发送 SOAP 1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40084886/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com