2011-01-24 107 views
1

我是帶有PHP(以及一般SOAP)的SOAP新手。我在SoapClient類遇到問題。它需要四個參數(請求,位置,操作,版本),但我真的不知道這些參數與我嘗試使用的Web服務有關。PHP SOAP SoapClient參數

http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Synchttp://www.agemni.com/_anet/ADBAccess.asmx?op=getCMSTables

這是我最好的猜測:

$wsdl = 'http://www.agemni.com/_anet/ADBAccess.asmx?WSDL'; 

$action = 'http://webservice.agemni.com/getCMSTables'; 
$request = 'POST /_anet/ADBAccess.asmx HTTP/1.1 
Host: www.agemni.com 
Content-Type: text/xml; charset=utf-8 
Content-Length: 10000 
SOAPAction: "http://webservice.agemni.com/getCMSTables" 

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <getCMSTables xmlns="http://webservice.agemni.com/getCMSTables" /> 
    </soap:Body> 
</soap:Envelope>" 
'; 
$location = 'http://www.agemni.com/_anet/ADBAccess.asmx'; 
$version ='1'; 


$client = new SoapClient($wsdl); 
$response = $client->__doRequest($request, $location, $action, $version); 

我不要求任何人都可以幫我這個忙,但如果你能幫助澄清$ action,$ request和$ location應該是什麼(非常確定$ version只是一個int 1或2)我將非常感激。

回答

1

那麼,如果您不想處理請求的細節並且您擁有WSDL文件,則不需要設置這些參數。只需實例化WSDL文件的路徑,它假設包含其他所有內容。在你只需要調用

$response = $client->getCMSTables(); 

參見:http://php.net/manual/en/soapclient.soapclient.php

+0

甜!謝謝。在這種特殊情況下,你不會碰巧知道如何通過看看文檔證明我已經登錄了嗎? – timmyc 2011-01-25 00:39:28