1

您好,我需要在php中使用密码、用户名和 SourceId 连接到 SOAP Web 服务。SOAP 请求是:

POST /webservices/AgentOnlineReservation.asmx HTTP/1.1
Host: 54.228.189.53
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetHotelsData"

<?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>
    <GetHotelsData xmlns="http://tempuri.org/">
      <SourceId>string</SourceId>
      <UserName>string</UserName>
      <Password>string</Password>
    </GetHotelsData>
  </soap:Body>
</soap:Envelope> 

请帮我。

4

1 回答 1

8

使用本机SoapClient库:

$client = new SoapClient('linkhere.com/AgentOnlineReservation.asmx?wsdl');

$response = $client->GetHotelsData(array(
    'SourceId' => '...',
    'UserName' => '...',
    'Password' => '...'
));

print_r($response);

在 SoapClient 调用中传递的链接是 WSDL(Web 服务描述语言)文件。

于 2013-06-11T11:39:01.680 回答