I'm generating a WSDL and I need to change the function name in the response to match the name from the client (which I have no control over).
Here's the WSDL response I'm getting:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost:8000/soap/index.php?wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:fooFunctionResponse>
<return xsi:type="xsd:boolean">true</return>
</ns1:fooFunctionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I need the line <ns1:fooFunctionResponse>
to read <ns1:fooFunctionAcknowledgement>
.
Here is my Soap server:
if (isset($_GET['wsdl'])) {
ini_set('soap.wsdl_cache_enabled', 0);
$soapAutoDiscover = new \Zend\Soap\AutoDiscover(new \Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeSequence());
$soapAutoDiscover->setBindingStyle(array('style' => 'document'));
$soapAutoDiscover->setOperationBodyStyle(array('use' => 'literal'));
$soapAutoDiscover->setClass('SoapFunction');
$soapAutoDiscover->setUri(http://localhost:8000/soap/index.php);
$soapAutoDiscover->handle();
} else {
$soap = new \Zend\Soap\Server(null, array("soap_version" => SOAP_1_2, 'uri' => 'http://localhost:8000/soap/index.php?wsdl', 'classmap' => array('Identification', 'RemoteIdentification')));
$soap->setClass('SoapFunction');
$soap->handle();
}
I've found this line of code in the Zend framework (Autodiscover.php
line 514) which looks like it controls the naming of the function:
$element = [
'name' => $functionName . 'Response',
'sequence' => $sequence
];
But changing it does nothing at all, the parent method is never called. I've no idea how to solve this problem, please help.
I've discovered that this line does change the function name, however I'm using SoapUI to test my API, and from SoapUI I always see Response
instead of whatever I change the string to. In Chrome, I see Acknowledgement
.
Why does SoapUI show a different function name?
I don't know much about Zend Framework and/or it's structure. But I think you can simply extend the class containing the response()
method and overwrite the method.
// Example Zend Class
class Zend_Class {
public function response()
{
// ...
}
}
// Your own Class
class Own_Class extends Zend_Class
{
public function ResponseBoohoo()
{
return parent::response();
}
}
If I totally and utterly misunderstood you, I apologize. :)