I'm successfully calling SOAP functions via a WSDL interface using
PHP5, but sometimes the functions return things that are complex
objects with methods as well as attributes. For example, the
interface I'm using has a query function which returns an array, but
it also has a function called IsDone() which can be called to find
out if this is the last page of results (it returns records in batches).
It goes like this:
<?php
require_once 'MyClient.class.php';
$mc = new MyClient();
$mc->dologin('id', 'pass');
try {
$res = $mc->query(array('queryString' => 'select Field from
Table'));
$alldone = $res->isDone();
} catch (SoapFault $f) {
print 'Caught Exception: '. $f->faultstring. "\n";
var_dump($mc);
}
?>
You can see that $res is the result returned from the query, and it
is presented as a stdClass object with results stored in an array
property. However, when I try to call $res->IsDone(), it fails to work:
PHP Fatal error: Call to undefined method stdClass::isDone()
I have some example code in Java for the same WSDL that makes it look
very simple:
...
queryResult = binding.query("select Field from Table");
if (queryResult.isDone()) {
...
How on earth do I do that in PHP? I don't think that creating PHP
classes and using classmap will help (it just moves the problem), at
least partly because this is a dynamic WSDL that is subject to change.
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@xxxxxxxxxxxxxxxxxx | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php