views:

1443

answers:

1

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?
Thanks,
-Dave

+2  A: 

Hey Dave,

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

Jack