[英]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.