PHP SOAP 请求发送多个元素

PHP SOAP Request to send multiple elements

我正在尝试使用 PHP Soap 客户端订阅 Web 服务。我的 PHP 代码确实成功到达了 Web 服务,但没有传递订阅所需的所有元素。我尝试了两个不同的 PHP 文档,结果相同。我的代码基于以下 link https://devzone.zend.com/2202/php-and-soap-first-steps/。我使用 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>

我正在尝试使用 PHP Soap 创建 sae 结果。我的第一个 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>";

我已经使用 Wireshark 捕获了发布的 XML,但元素 "Source"、"Dest"、"MsgTag"、"SupportsPendingAssignments"、"ProtocolVersion" & "SubscriptionPort" 未发布。” WireShark Capture

第二个 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>";

?>   

对于为何未在 PHP Soap 客户端请求中传递元素的任何帮助,我将不胜感激。

我习惯于通过 soap 调用将参数作为标准类 PHP 对象发送。不是数组。也许只是在 $client->subscribe 调用

中将带有参数的数组转换为带有 (object)$parameters 的对象