PHP Soap Request

I am trying to call a soap request but my parameters are not being sent over.

Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no ‘searchID’ property in /data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php:20 Stack trace: #0 /data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php(20): SoapClient->__call(‘GetOffers’, Array) #1 /data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php(20): SoapClient->GetOffers(Object(SoapHeader), Array) #2 {main} thrown in /data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php on line 20

$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 required parameters for GetOffers Function
$params = array(
           'searchString' => '%',
           'searchID' => true,
           'searchDescription' => true);

$data = $soap->GetOffers($header, $params);  

var_dump($data);

Hello there!

Your soap call is wrong. When you call $soap->GetOffers you need to inform just your method parameters. The method doesn’t receive headers. You need to set headers using $soap->__setSoapHeaders($header) before $soap->GetOffers($params).

Hope this help.

I now receive the error below:

Fatal error: Uncaught SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request. —> System.NullReferenceException: Object reference not set to an instance of an object. at ProMail.WebServices.OMS.Order.authenticate(String webServiceName) at ProMail.WebServices.OMS.Order.GetOffers(List1 sortGroups, String categoryGroupDescription, PMObjectCollection1 customCategories, String mailerUID, String searchString, Boolean searchID, Boolean searchDescription, String priceClassDescription) at ProMail.WebServices.OMS.OMS.GetOffers(List1 sortGroups, String categoryGroupDescription, PMObjectCollection1 customCategories, String mailerUID, String searchString, Boolean searchID, Boolean searchDescription, String priceClassDescription) — End of inner exception stack trace — in /data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php:24 Stack trace: #0 /data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php(24): SoapClient->__ca in /data/6/1/115/96/1930748/user/2104655/htdocs/xpedite/Ecwid/soap-test.php on line 24

$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); 

// create an array of required parameters for GetOffers Function
$params = array(
           'searchString' => '"00002"',
           'searchID' => true,
           'searchDescription' => true);

$soap->__setSoapHeaders($header); 

$data = $soap->GetOffers($params);

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.