0

我需要调用一个肥皂服务器,他们提供这样的请求格式(请参阅此页面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 或其他东西来请求。

谢谢

4

1 回答 1

0

你可以这样做:

 $client = new SoapClient('https://book.mylimobiz.com/api/ApiService.asmx?WSDL');
 $params = array();
 $params["apiId"] = apiId;
 $params["apiKey"] = apiKey;
 $result = $client->Test($params);   
于 2012-07-27T19:03:11.273 回答