[英]returning soap xml response for a soap server php
我正在尝试使用本机php soap服务器在php中创建一个soap服务。 我已经准备了wsdl文件。 soap服务基本上可以调用四种方法。 请求ShowRemittanceDetail之一的输入soap请求如下所示。
<soap-env:body>
<ns1:showremittancedetailrequest>
<username>admin</username>
<password>pass</password>
<refno>USA1956127848</refno>
</ns1:showremittancedetailrequest>
</soap-env:body>
无论如何,soap请求没有标题,而我刚刚在此处显示了正文。 我解析肥皂请求没有问题。 响应应如下所示
<?xml version="1.0" encoding="ISO-8859-1"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns2:responseType xmlns:ns2="http://tempuri.org/response">
<code>00</code>
<message>Transaction does not exist or is not available</message>
<responseBody>
<responseStr>4</responseStr>
</responseBody>
</ns2:responseType>
</soapenv:Body>
</soapenv:Envelope>
这是当服务器中没有带有参考号的交易时生成的特定响应。 我已经收到了肥皂请求并进行了评估。 但是我对肥皂响应的返回类型有疑问。 我无法生成有效的回复。 肥皂服务器应返回哪种类型的响应?
我尝试过的事情:
looks like we got no xml document
。 我也尝试过以相同的结果重播本机php SoapVar()
。
我尝试返回在皂类服务器的类映射中指定的对象响应。 例如,对于上面的示例,我尝试返回具有相同结果的ShowRemittanceDetailResponse
对象。 ( looks like we got no xml document
)。
我试图返回一个DomDocument对象。 在这种情况下抛出的异常是
the encoded object does not have a responseStr property
。
请帮我。 提前致谢。
我发现的解决方案是返回SoapVar
对象。 我没有soapui,我在php中编写的客户端不正确。 因此,由于php soap客户端抛出异常,我无法验证返回的xml。 对我来说正确的方法是返回SoapVar。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.