如何使用nusoap调用soap服务器

时间:2012-05-04 14:43:59

标签: php soap

我需要拨打肥皂服务器,他们提供这样的请求格式(请参阅此页https://book.mylimobiz.com/api/ApiService.asmx?op=Test

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或其他东西。

由于

1 个答案:

答案 0 :(得分:0)

你可以这样做:

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