F.P
F.P

Reputation: 17831

SOAP error; missing parameter despite given arguments

The following soap request

$response = $this->client->__soapCall('Match', array('word' => 'test', 'strategy' => 'exact'));

yields the error

Uncaught SoapFault exception: [soap:Client] Parameter not specified (null)
Parameter name: word

How can this be? I specified the word parameter in the request, didnt I? Why doesn's the server recognize it?

The service I want to use is an online dictionary webservive

Upvotes: 0

Views: 2147

Answers (1)

Robbie
Robbie

Reputation: 17720

Generally you need to wrap the arguments in a double array:

$response = $this->client->__soapCall('Match', array(array('word' => 'test', 'strategy' => 'exact')));

It reads a bit nicer if you

$aParams  = array('word' => 'test', 'strategy' => 'exact');
$response = $this->client->__soapCall('Match', array($aParams));

Or you can simply call the Match function directly

$aParams  = array('word' => 'test', 'strategy' => 'exact');
$response = $this->client->Match($aParams);

Or, as a final resort, use the HTTP GET option: http://services.aonaware.com/DictService/DictService.asmx?op=Match

Should get you on the road again.

Upvotes: 4

Related Questions