note 100292 deleted from soapclient.soapclient by crell

From: Date: Mon, 04 Apr 2022 16:49:52 +0000
Subject: note 100292 deleted from soapclient.soapclient by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218081@lists.php.net to get a copy of this message
Note Submitter: titan at phpdevshell dot org ---- It should be noted that if you receive a return error : 'Object reference not set to an instance of an object.'. This could be due to something as simple as passing the incorrect parameters. When you look at this XML: <Get xmlns="http://example.com"> <request> <CustomerId>string</CustomerId> <From>dateTime</From> <To>dateTime</To> </request> </Get> Your code should look something like this: <?php try { $options = array( 'soap_version'=>SOAP_1_2, 'exceptions'=>true, 'trace'=>1, 'cache_wsdl'=>WSDL_CACHE_NONE ); $client = new SoapClient('http://example.com/doc.asmx?WSDL', $options); // Note where 'Get' and 'request' tags are in the XML $results = $client->Get(array('request'=>array('CustomerId'=>'1234'))); } catch (Exception $e) { echo "<h2>Exception Error!</h2>"; echo $e->getMessage(); } $results = $client->Get(array('request'=>array('CustomerId'=>'842115'))); ?>

« previous php.notes (#218081) next »