Zend Soap Server with wsdl autodiscovery doesn't work as expected -
duplicate of this question
i'm trying create web service zend_soap_server in wsdl autodiscovery mode, obtain strange effects... here code: server:
<?php require_once('zend/soap/autodiscover.php'); require_once('zend/soap/server.php'); require_once('zend/soap/wsdl.php'); require_once('library/soapactions.php'); $wsdl = new zend_soap_autodiscover(); $wsdl->setclass('soapactions'); if (isset($_get['wsdl'])) { $wsdl->handle(); } else { $server = new zend_soap_server('http://localhost:8083/server.php?wsdl'); $server->setclass('soapactions'); $server->setencoding('iso-8859-1'); $server->handle(); }
soapactions class:
class soapactions { /** * test function * * @param string $a * @param string $b * @return string */ public function test1($a, $b) { return "you passed me ".$a." ".$b; } /** * test function 2 * * @param string $a * @param string $b * @return string */ public function test2($a, $b) { return "you passed me ".$a." ".$b; }
}
i tried use function test1 , test2 using zend_soap_client class, here code:
require_once('zend/soap/client.php'); $client = new zend_soap_client("http://localhost:8083/server.php?wsdl"); try { echo $client->test2("foo","bar"); //this works! } catch (exception $e) { echo $e; } try { echo $client->test1("foo","bar"); //this doesn't work! } catch (exception $e) { echo $e; }
i cannot understand because test2 function works expected, test1 function return following exception:
soapfault exception: [sender] function ("test1") not valid method service in /usr/local/zend/share/zendframework/library/zend/soap/client.php:1121 stack trace: 0 /usr/local/zend/share/zendframework/library/zend/soap/client.php(1121): soapclient->__soapcall('test1', array, null, null, array) 1 /usr/local/zend/apache2/htdocs/webservice/client.php(6): zend_soap_client->__call('test1', array) 2 /usr/local/zend/apache2/htdocs/webservice/client.php(6): zend_soap_client->test1('foo', 'bar') 3 {main}
i tried invert functions name... result incredible, works test2! i'm getting crazy, seems somewhere on server side save function name...
can me?
solved! problem setting in php.ini file:
soap.wsdl_cache_enabled=1
i set 0
, works fine!
Comments
Post a Comment