Reputation: 8071
I am doing the following to expose the functions of an object via soap but it gives me as error
Server:
$soap_wrapper = new my_geo_soap_wrapper();
$soap_wrapper->set_geo_app($my_geo);
$server = new SoapServer(null, array('uri' => "urn://localhost/firstmobile"));
$server->setObject($soap_wrapper);
$server->handle();
Client:
$client = new SoapClient(null, array(
'location' => "http://127.0.0.1/firstmobile/simple_server.php",
'uri' => "http://127.0.0.1/firstmobile/"
));
$result = $client->__soapCall("geolocate",array($lat,$lng));
print $result;
Error:
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Call to a member function geolocate() on a non-object in /home/imran/projects/firstmobile/simple_client.php:15 Stack trace: #0 /home/imran/projects/firstmobile/simple_client.php(15): SoapClient->__soapCall('geolocate', Array) #1 {main} thrown in /home/imran/projects/firstmobile/simple_client.php on line 15
Upvotes: 2
Views: 2322
Reputation: 97898
I think the error is somewhere in the my_geo_soap_wrapper
class. If I read your code, and the error, correctly, the SOAP call ($client->__soapCall("geolocate",array($lat,$lng));
) is mapping to $soap_wrapper->geolocate($lat,$lng)
on the SOAP server end.
Based purely on the name of the class, I wonder if this "my_geo_soap_wrapper" class is delegating to some other object, which also has a method called geolocate
, and this is where the bug is? e.g.
class my_geo_soap_wrapper
{
function geolocate($lat,$lng)
{
// Will blow up if $this->delegated_object hasn't been set correctly
return $this->delegated_object->geolocate($lat,$lng);
}
}
Pure speculation, but might suggest a route to investigate.
Upvotes: 2