zf 1.9.6 zend_soap: Function (“doString”) is not a valid method for this service


Duplicate of <a href="https://stackoverflow.com/questions/5044213/zend-soap-server-with-wsdl-autodiscovery-doesnt-work-as-expected" rel="nofollow">this question</a>

I'm trying to work with Zend_Soap using zend framework 1.9.6 and php 5.3.1.

<h3>soap.php (wsdl generator)</h3> <?php require_once('Zend/Soap/Server.php'); require_once('Zend/Soap/AutoDiscover.php'); require_once('Soaping.php'); $_WSDL_URI="http://server/soap/soap.php?wsdl"; if(isset($_GET['wsdl'])) { hadleWSDL(); } else { handleSOAP(); } function hadleWSDL() { $autodiscover = new Zend_Soap_AutoDiscover(); $autodiscover->setClass('Soaping'); $autodiscover->handle(); } function handleSOAP() { global $_WSDL_URI; $soap = new Zend_Soap_Server($_WSDL_URI); $soap->setClass('Soaping'); $soap->handle(); } <h3>Soaping.php (web service class)</h3> <?php class Soaping { /** * * @param string $str * @return string */ function doString($str) { return $str; } } <h3> client.php - client </h3> <?php require_once('Zend/Soap/Client.php'); $_WSDL_URI="http://server/soap/soap.php?wsdl"; $client = new Zend_Soap_Client($_WSDL_URI); $client->doString('aaa');

when i execute the client.php file i get the error: Fatal error: Uncaught SoapFault exception: [Sender] Function ("do_math") is not a valid method for this service in /usr/local/ZendFramework-1.9.6/library/Zend/Soap/Client.php:1090 Stack trace: #0 /usr/local/ZendFramework-1.9.6/library/Zend/Soap/Client.php(1090): SoapClient->__soapCall('do_math', Array, NULL, NULL, Array) #1 [internal function]: Zend_Soap_Client->__call('do_math', Array) #2 /home/ufk/Projects/xpogames-development/xpo/soap/client.php(6): Zend_Soap_Client->do_math(1, 1) #3 {main} thrown in /usr/local/ZendFramework-1.9.6/library/Zend/Soap/Client.php on line 1090

<h3>xml that is created by following the link http://server/soap/soap.php?wsdl</h3>

<?xml version="1.0"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xpogames/soap/soap.php" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Soaping" targetNamespace="http://xpogames/soap/soap.php"><types><xsd:schema targetNamespace="http://xpogames/soap/soap.php"/></types><portType name="SoapingPort"><operation name="doString"><documentation>do string</documentation><input message="tns:doStringIn"/><output message="tns:doStringOut"/></operation></portType><binding name="SoapingBinding" type="tns:SoapingPort"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="doString"><soap:operation soapAction="http://xpogames/soap/soap.php#doString"/><input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://xpogames/soap/soap.php"/></input><output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://xpogames/soap/soap.php"/></output></operation></binding><service name="SoapingService"><port name="SoapingPort" binding="tns:SoapingBinding"><soap:address location="http://xpogames/soap/soap.php"/></port></service><message name="doStringIn"><part name="str" type="xsd:string"/></message><message name="doStringOut"><part name="return" type="xsd:string"/></message></definitions>

i see that the function exists in the xml, why can't i use it ?


if i add the following function to the class:<br /> /**<br /> * Add method<br /> *<br /> * @param Int $param1<br /> * @param Int $param2<br /> * @return Int<br /> */<br /> public function math_add($param1, $param2) {<br /> return $param1+$param2;<br /> } this function get recognized. but even if i change it to add_math2(), the function doesn't get recognized again.


ok it seems that php cached the first time i created a wsdl file and didn't recreate it.

soap caching can be disabled by the php directive soap.wsdl_cache_enabled=0


You should add comment for function only, then declare parameter input, output. Example:

/** * Add method * * @param Int $param1 * @param Int $param2 * @return Int */


  • Android ksoap web service
  • Handle SOAP fatal error when there is a connection issue
  • soapclient or fopen not working
  • Soap Header (Unexpected EOF in prolog)
  • How to execute a shell script through python
  • MongoDB: How to Sort a Query Before Updating
  • QT: set stylesheet for a QMenu object
  • Get row for each user where the count of a value in a column is maximum
  • KoGrid JSON Dynamic widgets, with nested server calls
  • Bundle install fails - Gem using github url - What is wrong?
  • Doctrine: UniqueEntity with Many-to-Many field
  • Cleave.js Phone CA
  • jQuery file download plugin
  • Why am I getting an Array of an Array with Doctrine 2 & Symfony 2 Data Transformer?
  • Uploading image with other parameters in SWIFT
  • Understanding Intl.DateTimeFormat as a JavaScript object
  • Is it possible to use arbitrary image sizes in caffe?
  • Runtime.exec() gives Error: Could not find or load main class
  • Error processing multiple files
  • Doctrine2 bulk import try to work with another entity
  • Passing “get” parameters doesn't work, parameter not visible in the link
  • Security issues with PHP's Readfile method
  • Eloquent paginate function in Slim 3 project using twig
  • onBackPressed() not being executed
  • Declaring variable dynamically in VB.net
  • Submit form in a displaytag pagination
  • javascript inside java/jsp code
  • Delete MySQLi record without showing the id in the URL
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Android Studio and gradle
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Hits per day in Google Big Query
  • coudnt use logback because of log4j
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Programmatically clearing map cache
  • How can i traverse a binary tree from right to left in java?