2012-05-04 37 views
0

調用SOAP服務器我需要調用一個SOAP服務器,它們提供了這樣的請求格式(請參閱本頁面https://book.mylimobiz.com/api/ApiService.asmx?op=Test如何使用的NuSOAP

POST /api/ApiService.asmx HTTP/1.1 
Host: book.mylimobiz.com 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 
SOAPAction: "https://book.mylimobiz.com/api/Test" 

<?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> 
    <Test xmlns="https://book.mylimobiz.com/api"> 
     <apiId>string</apiId> 
     <apiKey>string</apiKey> 
    </Test> 
    </soap:Body> 
</soap:Envelope> 

我使用PHP的NuSOAP發送請求,這裏是浩我試圖

require_once('lib/nusoap.php'); 

$serverPath = "https://book.mylimobiz.com/api/ApiService.asmx"; 
$param = array("apiId"=>"someapi","apiKey"=>"somekYE"); 
$client = new SoapClient($serverPath); 

    $tt = $client->call("Test",$param,"https://book.mylimobiz.com/api","https://book.mylimobiz.com/api/Test"); 

這是不工作 可以有人指導我如何使用要求或的NuSOAP一些別的東西。

感謝

回答

0

你可以這樣說:

$client = new SoapClient('https://book.mylimobiz.com/api/ApiService.asmx?WSDL'); 
$params = array(); 
$params["apiId"] = apiId; 
$params["apiKey"] = apiKey; 
$result = $client->Test($params);