I am trying to figure out how to deal with a WSDL in PHP using SoapClient and I am getting the dreaded:
SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object.
Here is the function I am trying to use:
CheckInventoryResponse CheckInventory(CheckInventory $parameters)
The struct:
string(47) "struct CheckInventory {
InventoryRequest ir;
}"
What I trying to do:
class PhpCheckInventory {
public $ir;
}
$client = new SoapClient($wsdl);
$header = new SOAPHeader($wsdl, 'Authentication', array('Username' => $username, 'Password' => $password));
$client->__setSoapHeaders($header);
try {
$parameter1 = new PhpCheckInventory();
$parameter2 = new SoapParam($parameter1, 'CheckInventory');
$result = $client->CheckInventory($parameter2);
} catch (SoapFault $exception) {
echo $exception;
}