andriuxs Posted January 2, 2008 Share Posted January 2, 2008 How to corectly define parameters in call function using PHP that I get this soap request: <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> I defined parameters this way: $par= array('Filter' => array('Name' => 'Language', 'Value' => 'lt-lt'), 'Filter' => array('Name' => 'Currency', 'Value' => 'LTL'))); and get error: System.NullReferenceException: Object reference not set to an instance of an object Quote Link to comment https://forums.phpfreaks.com/topic/84083-soap-call-function-from-php/ Share on other sites More sharing options...
Daniel0 Posted January 2, 2008 Share Posted January 2, 2008 I'm not sure what your question is, but have you tried to look at the SOAP functions? Quote Link to comment https://forums.phpfreaks.com/topic/84083-soap-call-function-from-php/#findComment-427990 Share on other sites More sharing options...
andriuxs Posted January 2, 2008 Author Share Posted January 2, 2008 Yes i read it and other methods works fine if there is no parameters but then i call GetProductList method with defined parameters it returns an error. So it means that I have defined parameters incorrectly, and I don't no how to define them correctly, that I could get this request: <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> my php code: $licenseKey = '498ec72c-e8e7-48f2-b300-d95666aeb141'; $soapClient = new soapclient_nusoap('https://api.acme.lt/0.1/commerce.asmx?WSDL', false); $soapFault = $soapClient->getError(); if ($soapFault) { echo '<h2>Constructor error</h2><pre>' . $soapFault . '</pre>'; } $soapClient->soap_defencoding = 'UTF-8'; $soapHeaders = '<LicenseHeader xmlns="http://schemas.acme.eu/"><LicenseKey>'.$licenseKey.'</LicenseKey></LicenseHeader>'; //I'd tried to define parameters in two ways but it doesn't worked. $par= array('Filter' => array('Name' => 'Language', 'Value' => 'lt-lt'), 'Filter' => array('Name' => 'Currency', 'Value' => 'LTL')); //$par = array('Name' => 'Language', 'Value' => 'lt-lt', 'Name' => 'Currency', 'Value' => 'LTL'); // Make Request //$result = $soapClient->call('GetVendorList', '', 'http://schemas.acme.eu/', 'http://schemas.acme.eu/GetVendorList', $soapHeaders); This works //$result = $soapClient->call('GetProductClassification', '', 'http://schemas.acme.eu/', 'http://schemas.acme.eu/GetProductClassification', $soapHeaders); This works $result = $soapClient->call('GetProductList', $par, 'http://schemas.acme.eu/', 'http://schemas.acme.eu/GetProductList', $soapHeaders); Quote Link to comment https://forums.phpfreaks.com/topic/84083-soap-call-function-from-php/#findComment-428002 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.