note 100292 added to soapclient.soapclient
| From: | titan at phpdevshell dot org | Date: | Wed, 06 Oct 2010 13:11:02 +0000 |
| Subject: | note 100292 added to soapclient.soapclient | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173001@lists.php.net to get a copy of this message | ||
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://yoururl.com">
<request>
<CustomerId>string</CustomerId>
<From>dateTime</From>
<To>dateTime</To>
</request>
</Get>
Your code should look something like this:
try {
$options = array(
'soap_version'=>SOAP_1_2,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
);
$client = new SoapClient('http://yoururl/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')));
----
Server IP: 69.147.83.197
Probable Submitter: 198.54.202.214
----
Manual Page -- http://www.php.net/manual/en/soapclient.soapclient.php
Edit -- https://master.php.net/note/edit/100292
Del: integrated -- https://master.php.net/note/delete/100292/integrated
Del: useless -- https://master.php.net/note/delete/100292/useless
Del: bad code -- https://master.php.net/note/delete/100292/bad+code
Del: spam -- https://master.php.net/note/delete/100292/spam
Del: non-english -- https://master.php.net/note/delete/100292/non-english
Del: in docs -- https://master.php.net/note/delete/100292/in+docs
Del: other reasons-- https://master.php.net/note/delete/100292
Reject -- https://master.php.net/note/reject/100292
Search -- https://master.php.net/manage/user-notes.php