PHP Soap Issue: Server was unable to process request. ---> Object reference not set to an instance of an object

13,675

You need to pass the name of that parameter as well (and pass in an array):

$WSDL = 'http://www.nanonull.com/TimeService/TimeService.asmx?WSDL';
$client = new SoapClient($WSDL);
$response = $client->getUTCTime(); // WORKS

$response = $client->getTimeZoneTime(array('timezone'=>'ZULU')); //works
print_r( $response);

see: http://www.nanonull.com/TimeService/TimeService.asmx?op=getTimeZoneTime

and: http://www.nanonull.com/TimeService/TimeService.asmx

Jack

Share:
13,675
user6741701
Author by

user6741701

Updated on June 05, 2022

Comments

  • user6741701
    user6741701 almost 2 years

    I'm using PHP 5.2.5.5 with Moodle 1.9.

    When I make a simple SOAP call without parameters, it works. However, as soon as I use a call with a parameter, it fails. If I capture the SOAP request with Fiddler, I see that it's not adding the parameter to the soap request at all.

    Here's my sample code:

    $WSDL = 'http://www.nanonull.com/TimeService/TimeService.asmx?WSDL';
    $client = new SoapClient($WSDL);
    $response = $client->getUTCTime(); // WORKS
    $response = $client->getTimeZoneTime('ZULU');  // SOAP FAULT
    

    Any suggestions?

  • Andy
    Andy about 12 years
    Also check the PHP manual (php.net/manual/en/soapclient.soapcall.php) in the comments there is a mention of .NET web services and needing to set up a mini-class.
  • Hafiz Shehbaz Ali
    Hafiz Shehbaz Ali over 6 years
    man. I just want to hug you. You eased my life. I wish that I could give you 10 votes.