2012-04-22 34 views
0

我有一個名爲newSettings arrayofstrings字段的SOAP webservice,我試圖發送它作爲正常的字符串數組使用nusoap,但它不工作,任何建議?發送arryofstring與php + nusoap

我的代碼:

$settings=array('password','composefontsize'); 
$param=array(
'EmailAddress'=> $userEmail, 
'newSettings' => $settings 
); 

$response=$this->client->call("GetRequestedUserSettings",$param); 

我的XML請求:

<?xml version="1.0" encoding="ISO-8859-1"?> 
<SOAP-ENV:Envelope 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/" xmlns:ns6388="http://tempuri.org"> 
<SOAP-ENV:Body><GetRequestedUserSettings xmlns="http://tempuri.org/"> 
<AuthUserName>admin</AuthUserName> 
<AuthPassword>XXXX</AuthPassword> 
<EmailAddress>[email protected]</EmailAddress> 
<requestedSettings></requestedSettings> 
</GetRequestedUserSettings> 
</SOAP-ENV:Body> 
</SOAP-ENV:Envelope>" 

更新:我$settings = array('string' => $value1,...)固定它;

+0

該解決方案應該作爲答案,以便您可以接受它。 :) – Alfabravo 2017-06-12 18:21:01

回答

0

你可以用肥皂調用:

try { 
    // ... 
} catch (SoapFault $e) { 
    echo $e->faultcode; 
} 

這樣,如果你要麼不符合WSDL規範或服務器超時,你會意識到這個問題。我相信這在使用SOAP時是必須的。

+0

webservice接受請求,但newSettings標籤爲空,因此我的數組未被識別。 – nathanr 2012-04-22 17:10:24

+0

我看你修好了,然後恭喜你 – ther 2012-04-22 18:13:08