用PHP连接到示例SOAP 1.1


Connect to sample SOAP 1.1 with PHP

你好,我需要连接到SOAP web服务与密码,用户名和SourceId在php。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> 

请帮帮我。

使用本地SoapClient库:

$client = new SoapClient('linkhere.com/AgentOnlineReservation.asmx?wsdl');
$response = $client->GetHotelsData(array(
    'SourceId' => '...',
    'UserName' => '...',
    'Password' => '...'
));
print_r($response);

SoapClient调用中传递的链接是WSDL (Web Service Description Language)文件