note 76831 added to function.soap-soapclient-soapcall
| From: | stephen at sekka dot co dot uk | Date: | Wed, 01 Aug 2007 14:30:09 +0000 |
| Subject: | note 76831 added to function.soap-soapclient-soapcall | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129102@lists.php.net to get a copy of this message | ||
If you are trying to use a .NET web service and every call you make returns the following error,
"Server was unable to process request. --> Object reference not set to an instance of an
object."
... then you need to pass Objects into the method rather than the standard variables.
To do this, you need to create mini classes that have properties of the variables you are trying to
pass, map them to the types of the WSDL, then pass them into the methods.
Here is an example,
<?php
class Test {
public $account;
public $password;
}
$parameters = new Test;
$parameters -> account = $username;
$parameters -> password = $password;
try {
$client = new SoapClient ("https://www.somewebsite.com/Service.asmx?wsdl",
array('classmap' => array('CheckUser' => 'Test')));
$client -> CheckUser ($parameters);
echo "Valid Credentials!";
}
catch (Exception $e) {
echo "Error!<br />";
echo $e -> getMessage ();
}
?>
----
Server IP: 194.145.210.4
Probable Submitter: 217.34.33.39
----
Manual Page -- http://www.php.net/manual/en/function.soap-soapclient-soapcall.php
Edit -- https://master.php.net/note/edit/76831
Del: integrated -- https://master.php.net/note/delete/76831/integrated
Del: useless -- https://master.php.net/note/delete/76831/useless
Del: bad code -- https://master.php.net/note/delete/76831/bad+code
Del: spam -- https://master.php.net/note/delete/76831/spam
Del: non-english -- https://master.php.net/note/delete/76831/non-english
Del: in docs -- https://master.php.net/note/delete/76831/in+docs
Del: other reasons-- https://master.php.net/note/delete/76831
Reject -- https://master.php.net/note/reject/76831
Search -- https://master.php.net/manage/user-notes.php