无法在nusoap webservice中序列化结果错误

时间:2016-05-17 09:50:29

标签: php web-services serialization wsdl nusoap

通过nusoap webservice

插入新订单时出现以下错误
    <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>
          <SOAP-ENV:Fault>
             <faultcode xsi:type="xsd:string">SOAP-ENV:Server</faultcode>
             <faultactor xsi:type="xsd:string"/>
             <faultstring xsi:type="xsd:string">unable to serialize result</faultstring>
             <detail xsi:type="xsd:string"/>
          </SOAP-ENV:Fault>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

请帮忙

2 个答案:

答案 0 :(得分:0)

错误说你的响应类没有序列化,应该序列化。

尝试序列化您的响应类,然后重试。

答案 1 :(得分:0)

您应该在注册服务时设置返回类型,如下例所示:

// registering login method in the wsdl
$input_array = array('username' => "xsd:string", 'password' => "xsd:string"); // login parameters
$return_array = array("return" => "xsd:string");
$this->nusoap_server->register('login', $input_array, $return_array, "urn:SOAPServerWSDL", "urn:" . $this->ns . "/login", "rpc", "encoded", "Login to server services");

在我的情况下,我将返回类型设置为字符串,我认为你应该这样做,