views:

946

answers:

1

This code works fine:


$result = $client->__call("optionalInfo", array(
    new SoapParam("...", "client"),
    new SoapParam("...", "add_code"))
);

When I try abstracting it a bit to make the script re-usable, I get this error:

Catchable fatal error: Object of class SoapClient could not be converted to string

The broken code is:



$params = array( new SoapParam($client, "client"),
             new SoapParam($add_code, "add_code")
);
$result = $client->__call($functionName, $params);

The last line is what is causing the problem.

+1  A: 

Are you sure you want to send the SoapClient interface as an argument to a function call on the same object?

new SoapParam($client, "client")
troelskn
That would be my problem, and no I did not mean to do that. "Client" happens to be a field for this particular web service and I completely overlooked that. Thanks!
Brian Griffin