user3150002 user3150002 - 4 months ago 6x
PHP Question

Error Calling Webservice Method Using SOAP

I'm a noobie when it comes to SOAP. I am trying to make a SOAP request. It works until I get to a specific method, and then fails with the following message: SOAP-ERROR: Encoding: object hasn't 'transactionIdIn' property

Here is my code:

ini_set("soap.wsdl_cache_enabled", "0");

//Set up client; username and password replaced for security
try {
$client = new SoapClient('',
array('Username'=> {username},
'Password' => {password}));
catch (Exception $e) {
echo $e->getMessage();

//Call dequeue2 method
try {
$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionId' => "0"));
catch (Exception $e) {
echo $e->getMessage();

Here is the wsdl I am calling:

Here are the relevant parts of the wsdl that I am looking at:

xmlns:xsd="" targetNamespace="http://websvcs.otswebws">
<schema xmlns="" targetNamespace="http://websvcs.otswebws">
<import namespace="http://datatype.otswebws"/>
<element name="dequeueResponse">...</element>
<element name="getSubscriberInfo">...</element>
<element name="getSubscriberInfoResponse">...</element>
<element name="dequeue2">
<element name="subscriberId" type="xsd:int"/>
<element name="transactionIdIn" type="xsd:long"/>

<wsdl:portType name="OTSWebSvcs">
<wsdl:operation name="dequeue">...</wsdl:operation>
<wsdl:operation name="getSubscriberInfo">...</wsdl:operation>
<wsdl:operation name="dequeue2">
<wsdl:input message="impl:dequeue2Request" name="dequeue2Request"></wsdl:input>
<wsdl:output message="impl:dequeue2Response" name="dequeue2Response"></wsdl:output>
<wsdl:fault message="impl:WSException" name="WSException"></wsdl:fault>

So, I guess I am not understanding the way the webservice is set up. From what I understand, this OTSWebSvcs webservice has a dequeue2 method, which accepts two parameters, subscriberId and transactionIdIn. Clearly, I am missing something. Any help would be greatly appreciated.


You have got a typo in your script here:

$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionId' => "0"));

It should be :

$result = $client->dequeue2(array('subscriberId'=> "1", 'transactionIdIn' => "0"));

as the soap Error tells you. Try it and let me know if it works for you now :-)