我有肥皂请求参数:
<soap:Body>
<GetProductList xmlns="http://schemas.acme.eu/">
<GetProductListRequest>
<Filters>
<Filter>
<Name>Language</Name>
<Value>lt-lt</Value>
</Filter>
<Filter>
<Name>Currency</Name>
<Value>LTL</Value>
</Filter>
</Filters>
</GetProductListRequest>
</GetProductList>
</soap:Body>
我尝试发送这样的请求:
$result = $client->GetProductList(array('Filters' => array(
'Filter'=> array('Name' => 'Language', 'Value' => 'lt-lt'),
'Filter'=> array('Name' => 'Currency', 'Value' => 'LTL'))));
但我在这里得到错误:
( ! ) Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\wamp\www\tarpine_xml\class\acme_xml.php:25 Stack trace: #0 C:\wamp\www\tarpine_xml\class\acme_xml.php(25): SoapClient->__call('GetProductList', Array) #1 C:\wamp\www\tarpine_xml\class\acme_xml.php(25): SoapClient->GetProductList(Array) #2 C:\wamp\www\tarpine_xml\index.php(18): ACME_XML->parseACME() #3 {main} thrown in C:\wamp\www\tarpine_xml\class\acme_xml.php on line 25
其他没有参数的请求可以正常工作。那么我的请求中的错误在哪里?
解决了
我已经创建了这个代码:
$parrams['GetProductListRequest']['Filters']['Filter'] = array();
$parrams['GetProductListRequest']['Filters']['Filter'][] = array('Name' => 'Language', 'Value' => 'lt-lt');
$parrams['GetProductListRequest']['Filters']['Filter'][] = array('Name' => 'Currency', 'Value' => 'LTL');
$result = $client->GetProductList($parrams);
它完美地工作:)