Php SOAP,在对象中使用的函数

Php SOAP,在对象中使用的函数,php,soap,Php,Soap,为了通过soap公开对象的函数,我做了以下操作,但它给了我一个错误 服务器: $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-

为了通过soap公开对象的函数,我做了以下操作,但它给了我一个错误

服务器

$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 = 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;
客户端

$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 = 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;
错误

$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 = 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;
致命错误:未捕获的SoapFault异常:[SOAP-ENV:Server]调用 中非对象上的成员函数geologite() /home/imran/projects/firstmobile/simple_client.php:15堆栈跟踪:#0 /home/imran/projects/firstmobile/simple_client.php(15): SoapClient->uuSOAPCall('geologite',Array)#1{main}已抛出 /第15行的home/imran/projects/firstmobile/simple_client.php


我认为错误在
my_geo\u soap\u wrapper
类中的某个地方。如果我阅读了您的代码,并且错误是正确的,那么SOAP调用(
$client->\uuSOAPCall(“geologite”,array($lat,$lng));
)正在映射到SOAP服务器端的
$SOAP\u wrapper->geologite($lat,$lng)

纯粹基于类的名称,我想知道这个“my_geo_soap_wrapper”类是否正在委托给其他对象,该对象也有一个名为
geologite
的方法,这就是错误所在?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);
     }
}
纯粹是猜测,但可能会建议一条调查路线