3

我有一个 php 网站。这里我需要实现机票搜索和预订功能。为了做到这一点,我使用了来自 ARZOO 网站的付费 API……我从 ARZOO 获得了所有文档。我已经阅读了整个文档。医生说

"Accessing this service requires standard SOAP client. SOAP client should authenticate
itself through user name and password. Client should get their IPs registered with
Arzoo and get a user account created. The Arzoo web service provides a service
point URL. Web service clients should post SOAP request message as an attachment
for the desired response. The XML structure of different web services is discussed in
the respective documents." 
You can connect to Arzoo XML services with the following test service point URLs:-

FlightAvailability:http://<url>/DOMFlightAvailability?wsdl

我认为需要通过肥皂发送请求是吗?但在空气可用性包含

Example Request Xml
<Request>
<Origin>BOM</Origin>
.............
.............
</Request>

我使用了以下代码

$post_string.="<Request>";
$post_string.="<Origin>$from</Origin><Destination>$to</Destination>";
........
......

$post_string.="</Request>";
$path = ":http://<url>/DOMFlightAvailability?wsdl"; 

$ch = curl_init($path); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string); //Send the data to the file
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
$val = curl_exec($ch);
 $headers = curl_getinfo($ch);
 $errr=curl_error($ch);

但它没有给出任何结果。文件说

RESPONSE XML:-
The response will be in <arzoo_response> </arzoo_response>. This contains the Request
also.

我不知道肥皂。

我完全失望了。请帮我。我想我会在发布请求后得到一个 xml 响应。但是我将如何发布我的数据?

请回复

非常感谢,如果有人帮助我,非常感谢

4

2 回答 2

4

我在使用 SOAP CLIENT 时也遇到错误,但是当我使用 nusoap 时,它们会给我结果..如果您遇到 ip/password mismatch 之类的错误,则使用此代码,然后您将调用 arzoo 来验证您的 clientid 和 clientpassword

    <?php
  ini_set('max_execution_time','180');
    include 'lib/nusoap.php';
   $location_URL ='http://avail.flight.arzoo.com';
   $action_URL ='http://demo.arzoo.com/ArzooWS/services/DOMFlightAvailability?wsdl';
$Request = '<Request>
<Origin>BOM</Origin>
<Destination>DEL</Destination>
<DepartDate>2017-02-02</DepartDate>
<ReturnDate>2017-02-02</ReturnDate>
<AdultPax>1</AdultPax>
<ChildPax>0</ChildPax>
<InfantPax>0</InfantPax>
<Currency>INR</Currency>
<Clientid>Given by Arzoo.com</Clientid>
<Clientpassword>Given by Arzoo.com</Clientpassword>
<Clienttype>ArzooFWS1.1</Clienttype>
<Preferredclass>E</Preferredclass>
<mode>ONE</mode>
<PreferredAirline>AI</PreferredAirline>
</Request>';

$clientinfo = array('soap_version'=>SOAP_1_1,
'location' =>$location_URL,
'uri' =>$action_URL,
 'style' => SOAP_RPC,
 'use' => SOAP_ENCODED,
 'trace' => 1,
 );

 $client = new nusoap_client('http://demo.arzoo.com/ArzooWS/services/DOMFlightAvailability?wsdl', $clientinfo);
//print_r($client);
$result = $client->call('getAvailability', array($Request));
echo"<pre>";
print_r($result);
$clientInfo =simplexml_load_string(utf8_encode($result));
$flight = $clientInfo->Response__Depart->OriginDestinationOptions->OriginDestinationOption;
$error =$clientInfo->error__tag;
//echo $error;
var_dump($flight);
//exit;
//echo"<pre>";
//print_r($result);
//ECHO $error;
?>
于 2017-02-02T09:38:39.480 回答
2

由于提到了它们,standard SOAP client并且您将 cURL 请求发送到永远不会给出任何响应的服务器。

$location_URL = "http://xx.xxx.xx.xxx/ArzooWS/services/DOMFlightAvailability";
$action_URL ="http://com.arzoo.flight.avail";

$client = new SoapClient('http://xx.xxx.xx.xxx/ArzooWS/services/DOMFlightAvailability?wsdl', array(
'soap_version' => SOAP_1_1,
'location' => $location_URL,
'uri'      => $action_URL,
'style'    => SOAP_RPC,
'use'      => SOAP_ENCODED,
'trace'    => 1,
));

try
{
    $result = $client->__call('getAvailability',array($req_int));
    $response= htmlentities($result);
}

您可以使用 SOAP1.1 请求。

于 2013-05-15T18:26:45.437 回答