Php 删除<;回报>;soapzend框架中的节点和类型属性
我正在使用SOAPZend框架在Symfony2中开发一个Web服务。我遵循这个教程来指导我 Web服务工作正常,我可以发送请求并获得我想要的答案,问题与框架发送的答案一起出现 每次返回响应时,所有我的XML都会进入一个节点Php 删除<;回报>;soapzend框架中的节点和类型属性,php,xml,symfony,soap,zend-framework,Php,Xml,Symfony,Soap,Zend Framework,我正在使用SOAPZend框架在Symfony2中开发一个Web服务。我遵循这个教程来指导我 Web服务工作正常,我可以发送请求并获得我想要的答案,问题与框架发送的答案一起出现 每次返回响应时,所有我的XML都会进入一个节点。另外,我生成的每个标记都有其数据类型 有没有一种方法可以在不添加任何其他内容的情况下返回作为响应生成的XML? XML返回的函数代码: /** * Return a test XML. * @return SimpleXml */ public functi
。另外,我生成的每个标记都有其数据类型
有没有一种方法可以在不添加任何其他内容的情况下返回作为响应生成的XML?
XML返回的函数代码:
/**
* Return a test XML.
* @return SimpleXml
*/
public function ping()
{
$xml = '<ping>
<ip>192.168.1.100</ip>
<timestamp>2017-01-10T12:30:00</timestamp>
</ping>';
$xml = simplexml_load_string($xml);
return $xml;
}
多谢各位
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://dev1.hodor/app_dev.php/api/f/" 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:pingResponse>
<return xsi:type="SOAP-ENC:Struct">
<ip xsi:type="xsd:string">192.168.1.100</ip>
<timestamp xsi:type="xsd:string">2017-01-10T12:30:00</timestamp>
</return>
</ns1:pingResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://dev1.hodor/app_dev.php/api/f/" 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:pingResponse>
<ip>192.168.1.100</ip>
<timestamp>2017-01-10T12:30:00</timestamp>
</ns1:pingResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
/**
* execute SOAP request
*/
public function handleSOAP($uri, $class)
{
// Soap server
$soap = new Soap\Server(null,
array('location' => $uri,
'uri' => $uri,
));
$soap->setClass($this->get($class));
// Response
$response = new Response();
$response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1');
ob_start();
// Handle Soap
$soap->handle();
$response->setContent(ob_get_clean());
return $response;
}