致命错误:未捕获的SoapFault异常:[soap:Server] System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---> System.NullReferenceException:未将对象引用设置为对象的实例。在ProMail.WebServices.OMS.Order.authenticate(String webServiceName)at ProMail.WebServices.OMS.Order.GetOffers(List 1 sortGroups, String categoryGroupDescription, PMObjectCollection
1 customCategories,String mailerUID,String searchString,Boolean searchID,Boolean searchDescription,String priceClassDescription)at at ProMail.WebServices.OMS.OMS.GetOffers(List 1 sortGroups, String categoryGroupDescription, PMObjectCollection
1 customCategories,String mailerUID,String searchString,Boolean searchID,Boolean searchDescription,String priceClassDescription)---内部异常堆栈跟踪结束---在/ data / 6/1 1/116/96/1930748/user / 2104655 / htdocs / xpedite / Ecwid / soap-test.php:7堆栈跟踪:#0 / data / 6/1 1/115/96/1930748 / user / 2104655 / htdocs /xpedite/Ecwid/soap-test.php(7):SoapClient-> __调用/data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php在线7
<?php
// http://rhu199.veracore.com/pmomsws/oms.asmx?wsdl
// GetOffers
$client = new soapclient('http://rhu199.veracore.com/pmomsws/oms.asmx?wsdl');
//var_dump($client->__getFunctions());
//var_dump($client->__getTypes());
// create an array of parameters
$param = array(
'UserName' => "Username",
'Password' => "Password",
'searchString' => '%',
'searchID' => true,
'searchDescription' => true);
$result = $client->GetOffers($param);
// assess the results
if (is_soap_fault($result)) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
?>
然后我认为身份验证标头可能是问题并重新编写代码如下,但现在$ params没有被传递。
$apiauth =array('Username'=>'Username','Password'=>'Password');
$wsdl = 'http://rhu199.veracore.com/pmomsws/oms.asmx?wsdl';
$header = new SoapHeader('http://omscom/', 'AuthHeader', $apiauth);
$soap = new SoapClient($wsdl);
$soap->__setSoapHeaders($header);
// create an array of parameters
$params = array(
'searchString' => '%',
'searchID' => true,
'searchDescription' => true);
$data = $soap->GetOffers($header, $params);
var_dump($data);