【问题标题】:PHP SoapClient - _SoapCall having to wrap parameters inside method namePHP SoapClient - _SoapCall 必须将参数包装在方法名称中
【发布时间】:2018-10-18 11:35:28
【问题描述】:

我有以下肥皂网络服务:

<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>
     <Customer_Get xmlns="http://example.com/">
       <token>string</token>
       <customerId>string</customerId>
     </Customer_Get>
   </soap:Body>
</soap:Envelope>

以下调用不起作用:

$soap = new SoapClient('link/to/.wsdl');
$result = $soap->__soapCall('Customer_Get', ['token' => 'asdad', 'customerId' => 1]);

但是,当我将参数数组包装在带有方法名称的数组中时,它可以工作:

$soap = new SoapClient('link/to/.wsdl');
$result = $soap->__soapCall('Customer_Get', ['Customer_Get' => ['token' => 'asdad', 'customerId' => 1]]); 

为什么我需要将参数包装在方法名称中?

【问题讨论】:

    标签: php wsdl soap-client


    【解决方案1】:

    因为这个电话

    $result = $soap->__soapCall('Customer_Get', ['Customer_Get' => ['token' => 'asdad', 'customerId' => 1]]);
    

    是这里调用的简写(带有“参数”):

    $result = $soap->__soapCall('Customer_Get', ['parameters' => ['Customer_Get' => ['token' => 'asdad', 'customerId' => 1]]]);
    

    【讨论】:

      猜你喜欢
      • 2013-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-12
      相关资源
      最近更新 更多