2011-04-13 112 views
1
$client = new SoapClient(null, array('location' => "http://www.xxx.com/demo/webservice/wsHotel.sh",'uri' => "http://www.xxx.com/demo/", 'encoding' =>"ISO-8859-9")); 

$parm['login'] = "UserName"; 
$parm['pass'] = "Pass"; 
$parm['agency_code'] = "AgencyCode"; 
$parm['letters'] = "Germany"; 
$inf = ($client->__soapCall("destinationListByLetterV2",array($parm)));` 

<?xml version="1.0" encoding="UTF-8"?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <ns1:destinationListByLetterV2 xmlns:ns1="urn:http://www.xxx.com/demo/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <params xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Array" ns2:arrayType="xsd:string[4]"> 
    <item xsi:type="xsd:string">UserName</item> 
    <item xsi:type="xsd:string">Pass</item> 
    <item xsi:type="xsd:string">AgencyCode</item> 
    <item xsi:type="xsd:string">Germany</item> 
    </params> 
    </ns1:destinationListByLetterV2> 
</soap:Body> 
</soap:Envelope> 

缺少參數問題?如何soapclient請求到XML請求?PHP SoapClient的,以XML請求

+0

嗨,你可以更具體一點你的問題? [SoapClient](http://us.php.net/manual/en/class.soapclient.php)將創建一個XML負載,因爲這是SOAP的本質。請求被髮送到實例化SoapClient時指定的端點。 – quickshiftin 2012-01-31 23:48:40

回答

0
$parm['login'] = "UserName"; 
$parm['pass'] = "Pass"; 
$parm['agency_code'] = "AgencyCode"; 
$parm['letters'] = "Germany"; 

然後,你可以這樣調用:

$result = $client->destinationListByLetterV2($parm);