PHP Soap Error: The server was unable to process the request. ---> The reference to the object is not installed in the instance of the object

I am 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 a SOAP request using Fiddler, I see that it does not add a parameter to the soap request at all.

Here is 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?

+2
source share
1 answer

You also need to pass the name of this parameter (and pass the 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

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

+4

Source: https://habr.com/ru/post/1771291/


All Articles