PHP NuSOAP 响应 [英] PHP NuSOAP response

查看:44
本文介绍了PHP NuSOAP 响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

nusoap服务器的响应是这样正常吗?

Is it normal that the response of the nusoap server is like this?

如果不是,我如何修复或删除 &lt&gt 并将其设为 <>>

If not, how do i fix or remove the &lt and &gt and make it as < and >

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 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:get_stocksResponse xmlns:ns1="VSR"><return xsi:type="xsd:string">&lt;facilitator&gt;
&lt;stock_response&gt;
    &lt;product&gt;
      &lt;productid&gt;1072722&lt;/productid&gt;
      &lt;voorraad&gt;888040&lt;/voorraad&gt;
    &lt;/product&gt;
    &lt;product&gt;
      &lt;productid&gt;1072724&lt;/productid&gt;
      &lt;voorraad&gt;888603&lt;/voorraad&gt;
    &lt;/product&gt;
&lt;/stock_response&gt;
&lt;/facilitator&gt;
</return></ns1:get_stocksResponse></SOAP-ENV:Body></SOAP-ENV:Envelope></code>

这是我在服务器上的注册函数

this is my register function in the server

$this->server->register('get_stocks',                // method name
        array('product' => 'xsd:int'),        // input parameters
        array('return' => 'xsd:string'),      // output parameters
        $this->_namespace,                      // namespace
        'urn:'.$this->_namespace.'#get_stocks',                // soapaction
        'rpc',                                // style
        'encoded',                            // use
        'Get stocks of products'            // documentation
    ); 

这是我的返回函数

$xmlDoc = new DOMDocument('1.0', 'utf-8');
$xmlDoc->formatOutput = TRUE;
...etc
$nodes = $xmlDoc -> getElementsByTagName ('facilitator');
$node = $nodes -> item(0);

return $xmlDoc->saveXML($node);

推荐答案

来自这个 Nusoap如何使用现有的 WSDL?

我找到了这个

var $methodreturnisliteralxml = false;

并在创建 nusoap 服务器时将其设置为 true

and just set it to true upon creating the nusoap server

$this->server->methodreturnisliteralxml = true;

这篇关于PHP NuSOAP 响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆