i must provide a function via SOAP which is called “echo”. I don’t know how to do this because echo is already resevered by PHP. Is there any way?
BTW: I can’t use rename_function or override_function. Pecl-Apd isn’t available at the system.
Here is some code-stuff:
PHP:
$soap_server = new SoapServer('service.wsdl');
$soap_server->setClass('TestClass');
$soap_server->handle();
from the service.wsdl:
<message name="echo">
<part name="parameters" element="tns:echo"/>
</message>
[...]
<portType name="MyService">
[...]
<operation name="echo">
<input message="tns:echo"/>
<output message="tns:echoResponse"/>
</operation>
[...]
</portType>
<binding name="MyServicePortBinding" type="tns:MyService">
[...]
<operation name="echo">
<soap:operation soapAction="urn:ping"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
[...]
</binding>
The SOAP-Client isn’t under my control. I must implement the given wsdl-file. But in my class always “echo” get called not “ping” and results in the error message PHP Fatal error: Function 'echo' doesn't exist in <file-path-and-name>.
My TestClass looks like this:
<?php
ini_set("soap.wsdl_cache_enabled", "0");
class TestClass {
public function __construct()
{
}
[...]
public function ping($inputString)
{
return $inputString;
}
}
?>
Finally I solved the problem using a Proxy Class:
My TestClass:
And the SoapServer looks like this: