PHP SoapClient-具有嵌套参数的Soap调用

时间:2018-10-16 10:05:18

标签: php soap-client

如果我有以下肥皂信封,如何在我的肥皂呼叫中包括日期范围的嵌套参数?

<GetOrders xmlns="http://example.com/">
  <token>string</token>
  <CustomerId>integer</CustomerId>
  <DateRange>
    <MinimumDate xmlns="http://example.com">dateTime</MinimumDate>
    <MaximumDate xmlns="http://example.com">dateTime</MaximumDate>
  </DateRange>
</GetOrders>

$soap = new SoapClient('link/to/.wsdl');
$result = $soap->__soapCall('GetOrders', array('token' => 'asdad', 'CustomerId' => 1, 'MinimumDate' => '2018-10-01', 'MaximumDate' => '2018-10-16'));
var_dump($result);

1 个答案:

答案 0 :(得分:0)

通过使用嵌套在数组中:

$result = $soap->__soapCall('GetOrders', 
    array('token' => 'asdad', 'CustomerId' => 1, 
    'DateRange' => array('MinimumDate' => '2018-10-01', 'MaximumDate' => '2018-10-16')
));