[英]PHP SOAP Request to send multiple elements
I am attempting to subscribe to a web service using PHP Soap client. 我正在尝试使用PHP Soap客户端订阅Web服务。 My PHP code does successfully reach the web service but does not pass all the needed elements to subscribe.
我的PHP代码确实成功到达了Web服务,但是没有传递所有需要的元素来进行订阅。 I have tried two different PHP documents with identical results.
我尝试了两个具有相同结果的不同PHP文档。 My code is based on the following link https://devzone.zend.com/2202/php-and-soap-first-steps/ .
我的代码基于以下链接https://devzone.zend.com/2202/php-and-soap-first-steps/ 。 I used SoapUi to parse the wsdl and the subscribe function is formatted as
我使用了SoapUi来解析wsdl,并且订阅函数的格式为
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ass="http://assignment.soap.assignshare" xmlns:xsd="http://request.assignment.soap.assignshare/xsd">
<soapenv:Header/>
<soapenv:Body>
<ass:Subscribe>
<ass:SasReqSubscribe>
<xsd:Source>VendorC</xsd:Source>
<xsd:Dest>http://192.168.50.3:26001/SAIWebService</xsd:Dest>
<xsd:MsgTag>1</xsd:MsgTag>
<xsd:SupportsPendingAssignments>false</xsd:SupportsPendingAssignments>
<xsd:AppVersion>AppVersion</xsd:AppVersion>
<xsd:ProtocolVersion>1.20</xsd:ProtocolVersion>
<xsd:SubscriptionPort>http://localhost:26001/SAIWebService</xsd:SubscriptionPort>
</ass:SasReqSubscribe>
</ass:Subscribe>
</soapenv:Body>
</soapenv:Envelope>
I am trying to create the sae result using PHP Soap. 我正在尝试使用PHP Soap创建sae结果。 My First PHP code is as follows.
我的第一个PHP代码如下。
$wsdl = "http://192.168.50.3:26001/SAIWebservice?singlewsdl";
$client = new SoapClient($wsdl, array(
"trace"=>1,
"exceptions"=>0));
$name7 = "http://xx.xxx.183.202:8080";*/
$parameters= array("Source"=>'Test',"Dest"=>'http://192.168.50.3:26001/SAIWebService',"MsgTag"=>1,"SupportsPendingAssignments"=>0,
"AppVersion"=>'AppVersion,"ProtocolVersion"=>1.20,"SubscriptionPort"=>"http://xx.xxx.183.202:8080');
$values = $client->Subscribe($parameters);
print "<pre>\n";
print "<br />\n Request : ".htmlspecialchars($client->__getLastRequest());
print "<br />\n Response: ".htmlspecialchars($client->__getLastResponse());
print "</pre>";
I have used Wireshark to capture the posted XML, but the elements "Source", "Dest", "MsgTag", "SupportsPendingAssignments", "ProtocolVersion" & "SubscriptionPort" are not posted." WireShark Capture 我已经使用Wireshark来捕获发布XML,但是元素“源”,“目标”,“MsgTag”,“SupportsPendingAssignments”,“ProtocolVersion”&“SubscriptionPort”不公布。” Wireshark的捕获
Second PHP with same results 第二个PHP具有相同的结果
$wsdl = "http://192.168.50.3:26001/SAIWebservice?singlewsdl";
$client = new SoapClient($wsdl, array(
"trace"=>1,
"exceptions"=>0));
$name1 = "Test";
$name2 = "http://192.168.50.3:26001/SAIWebService";
$name3 = "1";
$name4 = "false";
$name5 = "AppVersion";
$name6 = "1.20";
$name7 = "http://xx.xxx.183.202:8080";
$parameters= array("Source"=>$name1,"Dest"=>$name2,"MsgTag"=>$name3,"SupportsPendingAssignments"=>$name4,"AppVersion"=>$name5,"ProtocolVersion"=>$name6,"SubscriptionPort"=>$name7);
$values = $client->Subscribe($parameters);
print "<pre>\n";
print "<br />\n Request : ".htmlspecialchars($client->__getLastRequest());
print "<br />\n Response: ".htmlspecialchars($client->__getLastResponse());
print "</pre>";
?>
I'd appreciate any help in why the elements are not being passed in the PHP Soap client request. 我非常感谢您提供任何帮助,以了解为什么未在PHP Soap客户端请求中传递元素。
I'm used to sending parameters through soap calls as a stdclass PHP object. 我习惯于通过肥皂调用将参数作为stdclass PHP对象发送。 Not arrays.
不是数组。 Maybe just cast the array with parameters to object with
(object)$parameters
in your $client->subscribe
call 也许只是将带有参数的数组转换
(object)$parameters
$client->subscribe
调用中带有(object)$parameters
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.