Обработка нескольких операций на SOAP-сервере с Zend

Я тестирую сервер SOAP, который должен получать несколько операций за один запрос. На сервере настроены Symfony 2.7, PHP 7.1 и zend-soap 2.7. Я не могу обновить версии Symfony и PHP, кроме случаев, когда они являются причиной этой проблемы.

Я пытаюсь очень глупый код. Контроллер выглядит следующим образом:

if ($request->isMethod('GET') and isset($_GET['wsdl'])) {
$response = new Response();
$response->headers->set('Content-Type', 'text/xml');

$wsdl = fopen('dummy.wsdl', 'r');

$response->setContent(fread($wsdl, filesize('dummy.wsdl')));

return $response;
}
elseif ($request->isMethod('POST')) {
$server = new Server('dummy.wsdl');
$server->setObject($this->get('app.service.soap_dummy'));

$response = new Response();
$response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1');

ob_start();
$server->handle();
$response->setContent(ob_get_clean());

return $response;
}

Он в основном вызывает сервис, который имеет одну функцию:

class SoapDummy
{
/**
* @return int
*/
public function getNumber()
{
return 1;
}

}

Файл WSDL это:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://localhost/soap/dummy" 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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="SoapDummy" targetNamespace="http://localhost/soap/dummy">
<types>
<xsd:schema targetNamespace="http://localhost/soap/dummy"/>
</types>
<portType name="SoapDummyPort">
<operation name="getNumber">
<documentation>getNumber</documentation>
<input message="tns:getNumberIn"/>
<output message="tns:getNumberOut"/>
</operation>
</portType>
<binding name="SoapDummyBinding" type="tns:SoapDummyPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getNumber">
<soap:operation soapAction="http://localhost/soap/dummy#getNumber"/>
<input><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/soap/dummy"/></input>
<output><soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/soap/dummy"/></output>
</operation>
</binding>
<service name="SoapDummyService">
<port name="SoapDummyPort" binding="tns:SoapDummyBinding">
<soap:address location="http://localhost/soap/dummy"/>
</port>
</service>
<message name="getNumberIn"/>
<message name="getNumberOut">
<part name="return" type="xsd:int"/>
</message>

Я делаю следующую просьбу:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<getNumber xmlns="http://localhost/soap/producto"/>
<getNumber xmlns="http://localhost/soap/producto"/>
</Body>
</Envelope>

И я получаю следующий ответ:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/soap/dummy" 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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getNumberResponse>
<return xsi:type="xsd:int">1</return>
</ns1:getNumberResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Но мне нужно это:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/soap/dummy" 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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getNumberResponse>
<return xsi:type="xsd:int">1</return>
</ns1:getNumberResponse>
<ns2:getNumberResponse>
<return xsi:type="xsd:int">1</return>
</ns2:getNumberResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Почему я не получаю оба ответа?

Я искал документацию SOAP для Symfony, PHP а также Zend чтобы увидеть, если я пропустил какой-то параметр конфигурации, но я не могу найти ничего подобного. Я также безуспешно искал этот вопрос здесь.

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]