Jump to content

Problem figuring out a Simple Soap Client


james2008

Recommended Posts

Hi,

 

I'm trying to create a SOAP client that access a Coldfusion Web service.  The service returns an XML document.  Here's the specs for accessing the Web service:

 

Parameters

AccountID

Numeric, required (Assigned to you by InstantService)

UserID

String, required, UserID (Assigned to you by InstantService)

Password

String, required (Assigned to you by InstantService)

ReturnType

String, required: base64 or normal

The following is an example of the returned XML (refer to the Standard Export format document for an explanation of the data fields):

<cfinvoke

webservice = "https://ws.instantservice.com/isws/LookupTableData.cfc?wsdl"

method = "GetDepartment"

returnVariable = "returnedXML" >

<cfinvokeargument name="AccountID" value="5000">

<cfinvokeargument name="UserID" value="yourid">

<cfinvokeargument name="Password" value="yourpass">

<cfinvokeargument>

 

Here's what I've came up with.  It seems to connect alright, but nothing is being returned.  Any help is appreciaed:

<?php

 

$arguments = array(

'AccountID'=> 1759,

'UserID' => 'ctiedu',

'Password' => '47355'

);

$client = new soapclient('https://ws.instantservice.com/isws/lookuptabledata.cfc?wsdl');

 

// Call RemoteFunction ()

$error = 0;

 

try {

// get catch error when trying to pass arguments in as array, so just passing each as a param.  The functin is GetDepartment

$test = $client->__call("GetDepartment",1759,'ctiedu','47355');

echo 'made it here' ;

print_r($test->returnedXML);

} catch (SoapFault $fault) {

$error = 1;

echo 'Returned the following ERROR: ' .$fault->faultcode . '-' . $fault->faultstring ; 

}

 

// kill object

unset($client);

?>

Nevermind, I figured it out:

 

<?php

$arguments = array(

'AccountID'=> 1759,

'UserID' => 'citiedu',

'Password' => '47355',

'ReturnType' => 'xml'

);

$client = new soapclient('https://ws.instantservice.com/isws/lookuptabledata.cfc?wsdl');

 

// Call RemoteFunction ()

$error = 0;

 

try {

$result = $client->__call('GetDepartment', $arguments);

 

} catch (SoapFault $fault) {

$error = 1;

echo 'Returned the following ERROR: ' .$fault->faultcode . '-' . $fault->faultstring ; 

}

print_r($result);

// kill object

unset($client);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.