"Object reference not set to an instance of an object" error connecting to SOAP server from PHP "Object reference not set to an instance of an object" error connecting to SOAP server from PHP php php

"Object reference not set to an instance of an object" error connecting to SOAP server from PHP


You're close. Looking at the WSDL the InventoryList method takes an object called "request". Modify your call line slightly:

$client->InventoryList(array("request" => array("LoginId" => $login_id, "Password" => $password));


Probably it's not the same case but it also gives the same error if you don't specify empty strings in fields you don't need to use, taken from http://www.sitepoint.com/forums/showthread.php?755549-SOAP-XML-Object-reference-not-set-to-an-instance-of-an-object


I my case the problem was in typo:

In given docs the filed name was documentShipmentAddress (and I was using this)

but in wdsl (schema) was:

shipmentAddress

So that could be the problem with this error message.I have changed the field name to shipmentAddress and it solved the problem.