簡體   English   中英

如何使用nusoap調用soap服務器

[英]how to call soap server using nusoap

我需要調用一個肥皂服務器,它們提供這樣的請求格式(請參閱此頁面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或其他東西。

謝謝

您可以這樣做:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM