通过发送 SOAP 请求实现 Air API [英] Implement an Air API by sending a SOAP request

查看:21
本文介绍了通过发送 SOAP 请求实现 Air API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

"访问此服务需要标准的 SOAP 客户端.SOAP 客户端应该进行身份验证自己通过用户名和密码.客户应该注册他们的IPArzoo 并创建一个用户帐户.Arzoo 网络服务提供了一个服务点网址.Web 服务客户端应将 SOAP 请求消息作为附件发布对于所需的响应.不同 Web 服务的 XML 结构在相应的文件."您可以使用以下测试服务点 URL 连接到 Arzoo XML 服务:-航班可用性:http://<url>/DOMFlightAvailability?wsdl

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

示例请求 Xml<请求><Origin>BOM</Origin>………………………………</请求>

我使用了以下代码

$post_string.="";$post_string.="<Origin>$from</Origin><Destination>$to</Destination>";…………......$post_string.="</Request>";$path = ":http:///DOMFlightAvailability?wsdl";$ch = curl_init($path);curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);//将数据发送到文件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);

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

响应 XML:-响应将在 <arzoo_response> 中.</arzoo_response>.这包含请求还.

我不知道 SOAP.

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

请回复

非常感谢,如果有人帮助我,那就太好了

解决方案

我在使用 SOAP CLIENT 时也遇到错误,但是当我使用 nusoap 然后他们给我结果..如果你遇到错误,如 ip/password mismatch then您将调用 arzoo 来验证您的客户端 ID 和客户端密码

 <Origin>BOM</Origin><目的地>DEL</目的地><出发日期>2017-02-02</出发日期><退货日期>2017-02-02</退货日期><AdultPax>1</AdultPax><ChildPax>0</ChildPax><InfantPax>0</InfantPax><货币>印度卢比</货币><Clientid>由 Arzoo.com 提供</Clientid><Clientpassword>由 Arzoo.com 提供</Clientpassword><Clienttype>ArzooFWS1.1</Clienttype><Preferredclass>E</Preferredclass><mode>ONE</mode><PreferredAirline>AI</PreferredAirline></请求>';$clientinfo = array('soap_version'=>SOAP_1_1,'位置' =>$location_URL,'uri' =>$action_URL,'风格' =>SOAP_RPC,'使用' =>SOAP_ENCODED,'跟踪' =>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);//出口;//echo"

";//print_r($result);//ECHO $error;?>

I have a php web site. Here I need to implement air ticket searching and booking functionality. In order to do this, I have used a paid API from ARZOO web site... I got all the documentation from ARZOO. I have read the entire doc. The Doc Says

"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

I think need to send the request via soap is it? But in the air availability contains

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

I have used the following code

$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);

But it's not giving any result. The documents says

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

I don't know SOAP.

I am totally disappointed. Please Help me. I think I will get an xml response after posting the request. But how I will post my data?

Please reply

Many thanks, if anyone help me, its great appreciable

解决方案

i also getting error while using SOAP CLIENT but when i use nusoap then they give me result..using this code if u get error like ip/password mismatch then You will call arzoo to verify your clientid and 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;
?>

这篇关于通过发送 SOAP 请求实现 Air API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆