PHP SoapClient - _SoapCall 必须将参数包装在方法名称中
PHP SoapClient - _SoapCall having to wrap parameters inside method name
我有以下肥皂网络服务:
<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]]);
为什么我需要将参数包装在方法名称中?
因为这个电话
$result = $soap->__soapCall('Customer_Get', ['Customer_Get' => ['token' => 'asdad', 'customerId' => 1]]);
是此调用的 shorthand(使用 'parameters'):
$result = $soap->__soapCall('Customer_Get', ['parameters' => ['Customer_Get' => ['token' => 'asdad', 'customerId' => 1]]]);
我有以下肥皂网络服务:
<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]]);
为什么我需要将参数包装在方法名称中?
因为这个电话
$result = $soap->__soapCall('Customer_Get', ['Customer_Get' => ['token' => 'asdad', 'customerId' => 1]]);
是此调用的 shorthand(使用 'parameters'):
$result = $soap->__soapCall('Customer_Get', ['parameters' => ['Customer_Get' => ['token' => 'asdad', 'customerId' => 1]]]);