0

我正在开发一个航班预订 API。我通过以下方式将数据发送到服务器:

        $location_URL = "http://59.162.33.102/ArzooWS/services/DOMFlightBooking?wsdl";
        $action_URL ="http://booking.flight.arzoo.com";

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

我还在编辑解析的 XML 格式化请求下面提到了 XML SOAP 正文:

<?xml version="1.0" encoding="utf-8"?>
<Bookingrequest>
<onwardFlights>
<OriginDestinationOption>
<FareDetails>
<ChargeableFares>
<ActualBaseFare>5060</ActualBaseFare>
<Tax>4380</Tax>
<STax>32</STax>
<SCharge>0</SCharge>
<TDiscount>0</TDiscount>
<TPartnerCommission>0</TPartnerCommission>
</ChargeableFares>
<NonchargeableFares>
<TCharge>0</TCharge>
<TMarkup>300</TMarkup>
<TSdiscount>0</TSdiscount>
</NonchargeableFares>
</FareDetails>
<FlightSegments>
<FlightSegment>
<AirEquipType>321</AirEquipType>
<ArrivalAirportCode>DEL</ArrivalAirportCode>
<ArrivalDateTime>2013-10-20T08:00:00</ArrivalDateTime>
<DepartureAirportCode>BOM</DepartureAirportCode>
<DepartureDateTime>2013-10-20T06:00:00</DepartureDateTime>
<FlightNumber>6019</FlightNumber>
<OperatingAirlineCode>AI</OperatingAirlineCode>
<OperatingAirlineFlightNumber>6019</OperatingAirlineFlightNumber>
<RPH>
</RPH>
<StopQuantity>0</StopQuantity>
<airLineName>Air India</airLineName>
<airportTax>4380</airportTax>
<imageFileName>http://live.arzoo.com/FlightWS/image/AirIndia.gif</imageFileName>
<viaFlight>
</viaFlight>
<BookingClass>
<Availability>4</Availability>
<ResBookDesigCode>U</ResBookDesigCode>
</BookingClass>
<BookingClassFare>
<adultFare>5060</adultFare>
<bookingclass>U</bookingclass>
<classType>Economy</classType>
<farebasiscode>fjyS3YyUlEusLfJ4bwgPvQ==</farebasiscode>
<Rule>This fare is Refundable &lt;br&gt; Baggage : 25K&lt;br&gt;Booking Class : U|Re-Schedule Charges: Rs. 750 per sector + Fare difference (If any) +admin fee 500 + Service Fee of Rs. 250 &#13;
Sector .|Cancellation Charges : Basic fare +Airline administration fee 500  + Service Charges 250 Per Passenger Per Sector .&#13;
                        |</Rule>
<adultCommission>0</adultCommission>
<childCommission>0</childCommission>
<commissionOnTCharge>0</commissionOnTCharge>
</BookingClassFare>
<Discount>0</Discount>
<airportTaxChild>0</airportTaxChild>
<airportTaxInfant>0</airportTaxInfant>
<adultTaxBreakup>2950,147,1283</adultTaxBreakup>
<childTaxBreakup>0,0,0</childTaxBreakup>
<infantTaxBreakup>0,0,0</infantTaxBreakup>
<octax>0</octax>
</FlightSegment>
</FlightSegments>
<id>arzoo11</id>
<key>wtZcSVMY/gphWFSOTFWg8nkII1434EZIGjnpJNQzayEK8sDjVS91GicTJzH+TWN+pNURIyTJYKOW&#13;
O8yH8+0tzpA4t8aEEvzaOE6ZnTtBotFDwLtSiN0xXiTOGgS0siJI1l7d9ata/3rxTgfh9d8ZSmFY&#13;
VI5MVaDyd5WrIWHlQL5zqWDbQb1E1IoDSY1wep73c6lg20G9RNQQnpVlWM7U0ZY7zIfz7S3O4J6m&#13;
G25LJItzqWDbQb1E1IoDSY1wep73c6lg20G9RNSKA0mNcHqe93OpYNtBvUTUpvdITjbFOR52+H1V&#13;
tJqs5kJfo6Sh44vDThgZv6ARhgviIKxphH+kbb9fDhZYRaCPm3lupCgitSmWO8yH8+0tzolfF9kG&#13;
WM+AaZ58PxEZgqCbbbGbXj1Z0D7dHS59eVX1JxMnMf5NY37ZbJ5llqmBpycTJzH+TWN+2WyeZZap&#13;
gacnEycx/k1jftlsnmWWqYGnJxMnMf5NY37ZbJ5llqmBpycTJzH+TWN+2WyeZZapgacnEycx/k1j&#13;
ftlsnmWWqYGnJxMnMf5NY36po4tljIBmEJgePqv2qP9fd/Usd8Uuz7FDwLtSiN0xXvtUK9az69O/&#13;
JxMnMf5NY37yK2PFSCI6AM2hLlYrFkYJQ8C7UojdMV7NoS5WKxZGCcr5VjCR04wgRviI6n9DzL3N&#13;
oS5WKxZGCUPAu1KI3TFezaEuVisWRglDwLtSiN0xXv4Xbn4sigRMv18OFlhFoI/cKcKe7FftvScT&#13;
JzH+TWN+2WyeZZapgacnEycx/k1jftlsnmWWqYGnJxMnMf5NY377Oxb/b44TR5Y7zIfz7S3O16CE&#13;
sDaAROm13h/OHWeGHw==</key>
</OriginDestinationOption>
</onwardFlights>
<returnFlights>
</returnFlights>
<personName>
<CustomerInfo>
<givenName>Rajnish</givenName>
<surName>Dubey</surName>
<nameReference>Mr.</nameReference>
<psgrtype>adt</psgrtype>
</CustomerInfo>
</personName>
<telePhone>
<phoneNumber>9595959595</phoneNumber>
</telePhone>
<email>
<emailAddress>rajnishdubey1988@gmail.com</emailAddress>
</email>
<creditcardno>5266474530046446</creditcardno>
<Clientid>7232326</Clientid>
<Clientpassword>*AB424E52FBBHDSFS74DFFSA7B747A9BAF61F8E</Clientpassword>
<partnerRefId>100200</partnerRefId>
<Clienttype>ArzooFWS1.1</Clienttype>
<AdultPax>1</AdultPax>
<ChildPax>0</ChildPax>
<InfantPax>0</InfantPax>
</Bookingrequest>

        try
    {
        //$result = $client->getAvailability($dom->saveXML($request));
        $result = $client->getBookingDetails($dom->saveXML($request));
        $response= htmlentities($result);
        echo "<h1> Client Response: </h1><pre>".htmlspecialchars($result, ENT_QUOTES)."</pre>";

    }
    catch(Exception $e){
        echo "<h2>Exception Error!</h2>";
        echo $e->getMessage();
    }

现在,当数据被发送到服务器时,我得到一个异常“错误版本”。我检查了服务器端,这个特定客户端的日志根本没有被命中。表示服务器没有收到请求。相同的 WSDL 请求格式由航班的 AVAILABILITY API 创建。我正在通过 AVAILABILITY API 获取可用的航班列表。我将上述代码转换为 XML,API 文档的格式与我发送请求的格式相同。我在互联网上查了一下,但没有找到相同的解决方案。有人说我使用的 SOAP 版本不同,但事实并非如此。因为航班和酒店可用性 API 具有相同的请求和从服务器接收数据的方法。请帮我。我坚持这一点。您的帮助将不胜感激。

4

1 回答 1

0

这是 arzoo 提供的航班可用性的工作代码。我在使用 SOAP CLIENT 时也遇到错误,但是当我使用 nusoap 时,它们会给我结果。。如果您收到类似 ip/password mismatch 之类的错误,请使用此代码,然后您将调用 arzoo 进行验证您的客户端 ID 和客户端密码

    <?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:50:16.377 回答