所以我打算連接到第三方服務並在PHP中遇到一些問題。當我嘗試在WebService的Studio中的服務請求時,它工作正常,所發送的請求是這樣的:PHP SoapClient生成不同的格式化SOAP請求
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<createUser xmlns="http://ws.example.com">
<arg0 xmlns="">[email protected]</arg0>
<arg1 xmlns="">123</arg1>
<arg2 xmlns="">1234</arg2>
<arg3 xmlns="">1234567890abcdef</arg3>
<arg4 xmlns="">test</arg4>
<arg5 xmlns="">user</arg5>
<arg6 xmlns="">02472</arg6>
<arg7 xmlns="">[email protected]</arg7>
<arg8 xmlns="">A</arg8>
<arg9 xmlns="">0</arg9>
<arg10 xmlns="">true</arg10>
</createUser>
</soap:Body>
</soap:Envelope>
現在,當我嘗試從PHP使用以下命令調用服務:
$this->web_service->createAccount('[email protected]', 123, 1234, '1234567890abcdef', 'test', 'user', '12345', '[email protected]', 'A', 0, true)
和調試請求,我得到這個:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.example.com">
<SOAP-ENV:Body>
<ns1:createUser/>
<param1>123</param1>
<param2>1234</param2>
<param3>1234567890abdcef</param3>
<param4>test</param4>
<param5>user</param5>
<param6>12345</param6>
<param7>[email protected]</param7>
<param8>A</param8>
<param9>0</param9>
<param10>true</param10>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
有幾件事情立即跳出來在我的PHP SoapClient生成的請求。第一件事是第一個參數(第一次通過[email protected])沒有在param1中傳遞,第二個參數是。接下來的事情是createUser的請求是一個自動關閉標記,不包括正在傳遞的參數。顯然,整個結構與使用的標籤有一點不同。我已經嘗試使用數組(甚至沒有去引發請求),在SoapParam中包裝參數,使用__call()和使用__soapCall(),但沒有一個解決了這個問題。
任何人都知道這樣的PHP的SoapClient的產生的請求匹配的WebService的工作室短生成手動生成手工肥皂請求一個什麼可能解決這個問題?
? createAccount方法的定義是什麼? – Cfreak 2011-02-23 16:15:54
我正在使用WSDL,但不能公開發布該信息 – ryanzec 2011-02-23 16:37:43