1. 航班查询接口[AV]
1.1. 航班查询(AVH)[AV1]
1.1.1. 功能描述
此接口用于通过航空公司、日期及出发、抵达城市等条件发送avh指令查询可用航班。返回结果与avh信息一致,不管舱位是否可销售,均返回舱位码及相应座位数。
1.1.2. 接口地址
Webservice方式:
测试地址:http://wstest.51book.com:55779/ltips/services/getAvailableFlightService1.0?wsdl
正式地址:http://ws.tongyedns.com:8000/ltips/services/getAvailableFlightService1.0?wsdl
Post方式:
测试地址:http://wstest.51book.com:55779/ltips/services/getAvailableFlightServiceRestful1.0/getAvailableFlight
正式地址:http://ws.tongyedns.com:8000/ltips/services/getAvailableFlightServiceRestful1.0/getAvailableFlight
1.1.3. 方法名称
getAvailableFlight
1.1.4. 参数说明
AvailableFlightRequest (请求参数)  
参数名称 中文含义 类型 必填 备注
agencyCode 公司代码 String 是 接口开通账号
sign 验证信息 String 是 MD5加密
(agencyCode+dstAirportCode+orgAirportCode+安全码)
加密为32位小写
group Gds配置组 String 否 执行指令所使用配置组
officeNo 所用office String 否 所使用配置组内的office
pidNo 所用PID String 否 所使用配置PID
orgAirportCode 出发城市三字码 String 是 例:PEK
PEK 包含 NAY
SHA 包含 PVG
dstAirportCode 抵达城市三字码 String 是 例:SHA
airlineCode 航空公司两字码 String 否 默认查询所有航空公司
date 起飞日期 String 是 格式:“YYYY-MM-DD”
depTime 起飞时间 String 否 格式:“HHSS”
direct 是否直飞 String 否 D为直飞(可经停不中转)
param1 备用参数 String 否
param2 备用参数 String 否
param3 备用参数 String 否
param4 备用参数 String 否
AvailableFlightReply (返回结果)  
参数名称 中文含义 类型 必填 备注
returnCode 成功标识 String 是 S-成功;
F-失败;
returnMessage 失败信息 String 否 失败时的错误信息
flightItems 航班信息 List<WSFlightItem> 否 详见WSFlightItem定义param1 备用参数1 String 否
param2 备用参数2 String 否
param3 备用参数3 String 否
param4 备用参数4 String 否
以上是接口文档<?php
header('Content-Type: textml; charset=UTF-8');
$client = new SoapClient('http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl');
$orgAirportCode=!empty($_POST['fromcity']) ? trim($_POST['fromcity']) : '长沙';
$dstAirportCode=!empty($_POST['tocity']) ? trim($_POST['tocity']) : '广州';
$date=!empty($_POST['date']) ? trim($_POST['date']) : date('Y-m-d',time());
$agencyCode="XJYLTPCS";
$safecode="c3U(kFZY";
$signstr='md5($agencyCode+$dstAirportCode+$orgAirportCode+$safecode)'
$parm=array('orgAirportCode'=>$orgAirportCode,'dstAirportCode'=>$dstAirportCode,'date'=>$date,'agencyCode=>$agencyCode,'sign'=>$sign);
$result=$client->getAvailableFlightWithPriceAndCommision($parm);
$result=get_object_vars($result);
$obj_xml = simplexml_load_string($result); //print_r($obj_xml->children()->children()); 
?>
请各位大神帮看一下咋弄,我初弄不知咋着手了。

解决方案 »

  1.   

    $result=get_object_vars($result); ,$result结果不是xml ,print_r($result);打印一下就行了
      

  2.   

    $signstr='md5($agencyCode+$dstAirportCode+$orgAirportCode+$safecode)'
    1.没分号
    2.MD5在这里是无效的
    3.一般接口不会用加号拼接 请仔细参考demo或者文档备注说明
      

  3.   

    http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl
    只提供了以下方法,并没有你那 getAvailableFlightWithPriceAndCommision 方法
        [0] => getDomesticCityResponse getDomesticCity(getDomesticCity $parameters)
        [1] => getDomesticAirlinesTimeResponse getDomesticAirlinesTime(getDomesticAirlinesTime $parameters)
        [2] => getDomesticCityResponse getDomesticCity(getDomesticCity $parameters)
        [3] => getDomesticAirlinesTimeResponse getDomesticAirlinesTime(getDomesticAirlinesTime $parameters)http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl

    http://ws.tongyedns.com:8000/ltips/services/getAvailableFlightService1.0?wsdl
    提供了
    getAvailableFlightResponse getAvailableFlight(getAvailableFlight $parameters)