SoapServer无效响应

时间:2015-03-26 10:51:48

标签: php wsdl soapserver

我正在尝试创建SoapServer,从理论上看WSDL一切都应该没问题,但我实施的服务器返回的无效响应。 定义请求和响应的wsdl的一部分:

  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="testns">
      <s:element name="serviceRequest">
        <s:complexType>
                        <s:sequence>
                                <s:element name="id" form="unqualified" type="s:string" minOccurs="0" />
                                <s:element name="result" form="unqualified" minOccurs="0" maxOccurs="unbounded">
                                        <s:complexType>
                                                <s:sequence>
                                                        <s:element name="errorCode" form="unqualified" type="s:string" minOccurs="0" />
                                                        <s:element name="errorDescription" form="unqualified" type="s:string" minOccurs="0" />
                                                        <s:element name="nativeErrorCode" form="unqualified" type="s:string" minOccurs="0" />
                                                        <s:element name="nativeErrorDescription" form="unqualified" type="s:string" minOccurs="0" />
                                                </s:sequence>
                                        </s:complexType>
                                </s:element>
                        </s:sequence>
                </s:complexType>
      </s:element>
      <s:element name="serviceresponse">
        <s:complexType>
          <s:sequence>
                        <s:element name="result" form="unqualified" minOccurs="0" maxOccurs="unbounded">
                                        <s:complexType>
                                                <s:sequence>
                                                        <s:element name="errorCode" form="unqualified" type="s:string" minOccurs="0" />
                                                        <s:element name="errorDescription" form="unqualified" type="s:string" minOccurs="0" />
                                                        <s:element name="nativeErrorCode" form="unqualified" type="s:string" minOccurs="0" />
                                                        <s:element name="nativeErrorDescription" form="unqualified" type="s:string" minOccurs="0" />
                                                </s:sequence>
                                        </s:complexType>
                                </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>

和我在php处理程序中的函数:

function handleService($serviceRequest){
 try{
  throw new Exception("test exception",3);
 }catch (Exception $e){
  return array(array("serviceResponse"=>array(
    "result"=>array(
        "errorCode"=>"1",
        "errorDescription"=>"Error detected",
        "nativeErrorCode"=>"".$e->getCode(),
        "nativeErrorDescription"=>"".$e->getMessage()
        )
  )));
 }
}

这个结果发送response,如下所示:

   <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="testns">
    <SOAP-ENV:Body>
    <ns1:serviceResponse>
    <result/>
    </ns1:serviceResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

result标记为空,但应设置在我的服务器中描述它的数组。任何人都可以给我一个暗示我缺少的东西吗?

0 个答案:

没有答案