Skip to content

Instantly share code, notes, and snippets.

@yicone
Last active December 11, 2015 21:18
Show Gist options
  • Select an option

  • Save yicone/4661231 to your computer and use it in GitHub Desktop.

Select an option

Save yicone/4661231 to your computer and use it in GitHub Desktop.
FltIntlSearchFlights
namespace HHTravel.Base.Common.Framework.Web.CtripWSRef
{
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "CtripWSSoap", Namespace = "http://tempuri.org/")]
public partial class CtripWS : System.Web.Services.Protocols.SoapHttpClientProtocol
{
private System.Threading.SendOrPostCallback RequestOperationCompleted;
private System.Threading.SendOrPostCallback CommRequestOperationCompleted;
/// <remarks/>
public CtripWS(string url)
{
this.Url = url;
}
/// <remarks/>
public event RequestCompletedEventHandler RequestCompleted;
/// <remarks/>
public event CommRequestCompletedEventHandler CommRequestCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Request", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string Request(string requestXML)
{
object[] results = this.Invoke("Request", new object[] {
requestXML});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginRequest(string requestXML, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("Request", new object[] {
requestXML}, callback, asyncState);
}
/// <remarks/>
public string EndRequest(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void RequestAsync(string requestXML)
{
this.RequestAsync(requestXML, null);
}
/// <remarks/>
public void RequestAsync(string requestXML, object userState)
{
if ((this.RequestOperationCompleted == null))
{
this.RequestOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRequestOperationCompleted);
}
this.InvokeAsync("Request", new object[] {
requestXML}, this.RequestOperationCompleted, userState);
}
private void OnRequestOperationCompleted(object arg)
{
if ((this.RequestCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.RequestCompleted(this, new RequestCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CommRequest", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string CommRequest(string requestXML)
{
object[] results = this.Invoke("CommRequest", new object[] {
requestXML});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCommRequest(string requestXML, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("CommRequest", new object[] {
requestXML}, callback, asyncState);
}
/// <remarks/>
public string EndCommRequest(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void CommRequestAsync(string requestXML)
{
this.CommRequestAsync(requestXML, null);
}
/// <remarks/>
public void CommRequestAsync(string requestXML, object userState)
{
if ((this.CommRequestOperationCompleted == null))
{
this.CommRequestOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCommRequestOperationCompleted);
}
this.InvokeAsync("CommRequest", new object[] {
requestXML}, this.CommRequestOperationCompleted, userState);
}
private void OnCommRequestOperationCompleted(object arg)
{
if ((this.CommRequestCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.CommRequestCompleted(this, new CommRequestCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState)
{
base.CancelAsync(userState);
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void RequestCompletedEventHandler(object sender, RequestCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class RequestCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal RequestCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public string Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void CommRequestCompletedEventHandler(object sender, CommRequestCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CommRequestCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal CommRequestCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public string Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Ctrip.Entity.IntlFltRevOnlineEntity;
namespace Ctrip.IntlFlt.Service.Entity
{
/// <summary>
/// 国际机票航班查询请求实体
/// </summary>
/// <history>
/// <date>2010-03-16</date>
/// <programmer>zcchen</programmer>
/// <document>国际机票查询接口改造(43786)</document>
/// </history>
[Serializable]
public class FltIntlSearchFlightsRequest
{
private TripType tripType = TripType.OW;
private PassengerType passengerType = PassengerType.ADT;
private int passengerCount = 0;
private Eligibility eligibility = Eligibility.ALL;
private string businessID = String.Empty;
private ExpenseType businessType = ExpenseType.OWN;
private string airline = String.Empty;
private SeatGrade classGrade = SeatGrade.Y;
private SalesType salesType = SalesType.Online;
private string fareIds = String.Empty;
private FareType fareType = FareType.All;
private string agentID = String.Empty;
private ResultMode resultMode = ResultMode.All;
private OrderBy orderBy = OrderBy.Price;
private Direction direction = Direction.Asc;
private string shoppingInfoID = string.Empty;
private List<SegmentInfo> segmentInfos = new List<SegmentInfo>();
private List<Routing> routings = new List<Routing>();
private bool isCompress = false;
private bool isDirect = false;
private string transferType = "1";
/// <summary>
/// 行程类型
/// 默认:单程
/// </summary>
public TripType TripType
{
get { return tripType; }
set { tripType = value; }
}
/// <summary>
/// 乘客类型
/// 默认:全部
/// </summary>
public PassengerType PassengerType
{
get { return passengerType; }
set { passengerType = value; }
}
/// <summary>
/// 乘客数量
/// 默认:全部
/// </summary>
public int PassengerCount
{
get { return passengerCount; }
set { passengerCount = value; }
}
/// <summary>
/// 乘客资质
/// 默认:全部
/// </summary>
public Eligibility Eligibility
{
get { return eligibility; }
set { eligibility = value; }
}
/// <summary>
/// 商旅客户编号
/// </summary>
public string BusinessID
{
get { return businessID; }
set { businessID = value; }
}
/// <summary>
/// 商旅用户支出类型
/// 默认:自费
/// </summary>
public ExpenseType BusinessType
{
get { return businessType; }
set { businessType = value; }
}
/// <summary>
/// 舱空公司二字码
/// 默认:所有航空公司
/// </summary>
public string Airline
{
get { return airline; }
set { airline = value; }
}
/// <summary>
/// 舱位等级
/// 默认:Y(查询全部)
/// </summary>
public SeatGrade ClassGrade
{
get { return classGrade; }
set { classGrade = value; }
}
/// <summary>
/// 销售渠道
/// 默认:网上销售
/// </summary>
public SalesType SalesType
{
get { return salesType; }
set { salesType = value; }
}
/// <summary>
/// 指定运价ID
/// </summary>
public string FareIds
{
get { return fareIds; }
set { fareIds = value; }
}
/// <summary>
/// 运价类型
/// 默认:所有
/// </summary>
public FareType FareType
{
get { return fareType; }
set { fareType = value; }
}
/// <summary>
/// 票台编号
/// </summary>
public string AgentID
{
get { return agentID; }
set { agentID = value; }
}
/// <summary>
/// 结果模式
/// 默认:所有价格
/// </summary>
public ResultMode ResultMode
{
get { return resultMode; }
set { resultMode = value; }
}
/// <summary>
/// 排序字段
/// 默认:价格
/// </summary>
public OrderBy OrderBy
{
get { return orderBy; }
set { orderBy = value; }
}
/// <summary>
/// 排序方向
/// 默认:从低到高
/// </summary>
public Direction Direction
{
get { return direction; }
set { direction = value; }
}
/// <summary>
/// 已选航班信息
/// 查询下一程航班信息时必须带入的参数
/// </summary>
public string ShoppingInfoID
{
get { return shoppingInfoID; }
set { shoppingInfoID = value; }
}
/// <summary>
/// 航段信息
/// </summary>
public List<SegmentInfo> SegmentInfos
{
get { return segmentInfos; }
set { segmentInfos = value; }
}
/// <summary>
/// 选定航路信息
/// </summary>
public List<Routing> Routings
{
get { return routings; }
set { routings = value; }
}
/// <summary>
/// 是否压缩返回报文
/// 默认:不压缩
/// </summary>
public bool IsCompress
{
get { return isCompress; }
set { isCompress = value; }
}
/// <summary>
/// 是否查询直飞数据
/// 默认:false(返回所有数据), true(只返回直飞的数据), 默认为false(直飞有可能有经停)
/// </summary>
public bool IsDirect
{
get { return isDirect; }
set { isDirect = value; }
}
/// <summary>
/// 中转类型
/// 0 – 返回所有数据,
/// 1 – 仅返回直飞数据,即往返程查询返回:(直飞,直飞);单程查询返回:直飞
/// 2 – 仅返回非直飞数据,即往返程查询返回:(非直飞,非直飞);单程查询返回:非直飞
/// 4 – 仅在往返程查询下起作用,返回:(直飞,非直飞)和(非直飞,直飞);单程查询这个参数不起作用
/// 5 – 仅返回一程中转,即往返程查询返回:(一程中转,一程中转);单程查询返回:一程中转
/// 6 – 往返程查询返回:(直飞,一程中转)和(一程中转,直飞);单程查询返回:直飞或一程中转
/// 7 – 往返程查询返回:(直飞,直飞)、(一程中转,一程中转)、(直飞,一程中转)和(一程中转,直飞),即1,5,6的并集;单程查询返回:直飞或一程中转,在单程查询中,6和7的意义相同
/// 8 – 往返程查询返回:(非“直飞或一程中转”,非“直飞或一程中转”)、(直飞,非“直飞或一程中转”)、(一程中转,非“直飞或一程中转”)、(非“直飞或一程中转”,直飞)和(非“直飞或一程中转”、一程中转);单程查询返回:非“直飞或一程中转”
/// </summary>
public string TransferType
{
get { return transferType; }
set { transferType = value; }
}
}
/// <summary>
/// 航段信息
/// </summary>
/// <history>
/// <date>2010-03-16</date>
/// <programmer>zcchen</programmer>
/// <document>国际机票查询接口改造(43786)</document>
/// </history>
[Serializable]
public class SegmentInfo
{
private const string DEFAULT_TIMEPERIOD = "All";
private string dCode = String.Empty;
private string aCode = String.Empty;
private string dAirport = String.Empty;
private string aAirport = String.Empty;
private DateTime dDate = default(DateTime);
private string timePeriod = String.Empty;
/// <summary>
/// 出发城市码
/// </summary>
public string DCode
{
get { return dCode; }
set { dCode = value; }
}
/// <summary>
/// 到达城市码
/// </summary>
public string ACode
{
get { return aCode; }
set { aCode = value; }
}
/// <summary>
/// 出发机场
/// </summary>
public string DAirport
{
get { return dAirport; }
set { dAirport = value; }
}
/// <summary>
/// 到达机场
/// </summary>
public string AAirport
{
get { return aAirport; }
set { aAirport = value; }
}
/// <summary>
/// 出发日期
/// </summary>
public DateTime DDate
{
get
{
return dDate;
}
set { dDate = value; }
}
/// <summary>
/// 起飞时间段
/// 暂不用,默认0000-2400
/// </summary>
public string TimePeriod
{
get
{
if (timePeriod == null || timePeriod.Trim().Length == 0)
return DEFAULT_TIMEPERIOD;
return timePeriod;
}
set { timePeriod = value; }
}
}
/// <summary>
/// 路由信息
/// </summary>
/// <history>
/// <date>2010-03-16</date>
/// <programmer>zcchen</programmer>
/// <document>国际机票查询接口改造(43786)</document>
/// </history>
[Serializable]
public class Routing
{
private string dCode = String.Empty;
private string aCode = String.Empty;
private string dAirport = String.Empty;
private string aAirport = String.Empty;
private string airline = String.Empty;
private string seatClass = String.Empty;
private string flightNo = String.Empty;
private string operatorNo = String.Empty;
private int segmentInfoNo = 1;
private int no = 1;
/// <summary>
/// 出发城市
/// </summary>
public string DCode
{
get { return dCode; }
set { dCode = value; }
}
/// <summary>
/// 到达城市
/// </summary>
public string ACode
{
get { return aCode; }
set { aCode = value; }
}
/// <summary>
/// 出发机场
/// </summary>
public string DAirport
{
get { return dAirport; }
set { dAirport = value; }
}
/// <summary>
/// 到达机场
/// </summary>
public string AAirport
{
get { return aAirport; }
set { aAirport = value; }
}
/// <summary>
/// 舱空公司二字码
/// </summary>
public string Airline
{
get { return airline; }
set { airline = value; }
}
/// <summary>
/// 舱位代码
/// </summary>
public string SeatClass
{
get { return seatClass; }
set { seatClass = value; }
}
/// <summary>
/// 航班号
/// </summary>
public string FlightNo
{
get { return flightNo; }
set { flightNo = value; }
}
/// <summary>
/// 承运航班号
/// </summary>
public string OperatorNo
{
get { return operatorNo; }
set { operatorNo = value; }
}
/// <summary>
/// 航段数
/// </summary>
public int SegmentInfoNo
{
get { return segmentInfoNo; }
set { segmentInfoNo = value; }
}
/// <summary>
/// 航班序号
/// </summary>
public int No
{
get { return no; }
set { no = value; }
}
}
}
国际机票查询服务接口地址:
服务编号 服务名称 服务类型 服务地址
131304 FlightIntl.FlightSearch Development http://fltint.dev.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch Production http://fltws.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch Testing http://fltws.test.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch TestingL http://fltws.testl.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch TestingP http://fltws.testp.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch TestingU http://fltws.testu.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch TestingX http://fltws.testx.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch TestingY http://fltws.testy.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
131304 FlightIntl.FlightSearch UAT http://fltws.uat.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx
/*
度假调用国际机票实例代码:
Booking20130109\BusinessLayer\BusinessCore\ItemFlight\ItemFlight.cs
*/
/// <summary>
/// 取得国际航班系统机票(只返回一程数据)
/// </summary>
/// <param name="sysParameterList">系统机票查询参数</param>
/// <param name="startCity">出发城市</param>
/// <param name="clientSource">订单来源</param>
/// <param name="pkgData">上一程航班请求信息(json格式)</param>
/// <returns>航班实体</returns>
internal List<PkgItemEntity> GetIntlFlightsSearchList(List<PkgSysFlightParameterEntity> sysParameterList, int startCity, ClientSource clientSource, string pkgData)
<wsdl:definitions targetNamespace="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="Request">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="requestXML" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CommRequest">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="requestXML" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CommRequestResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CommRequestResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="RequestSoapIn">
<wsdl:part name="parameters" element="tns:Request"/>
</wsdl:message>
<wsdl:message name="RequestSoapOut">
<wsdl:part name="parameters" element="tns:RequestResponse"/>
</wsdl:message>
<wsdl:message name="CommRequestSoapIn">
<wsdl:part name="parameters" element="tns:CommRequest"/>
</wsdl:message>
<wsdl:message name="CommRequestSoapOut">
<wsdl:part name="parameters" element="tns:CommRequestResponse"/>
</wsdl:message>
<wsdl:portType name="FlightSearchSoap">
<wsdl:operation name="Request">
<wsdl:input message="tns:RequestSoapIn"/>
<wsdl:output message="tns:RequestSoapOut"/>
</wsdl:operation>
<wsdl:operation name="CommRequest">
<wsdl:input message="tns:CommRequestSoapIn"/>
<wsdl:output message="tns:CommRequestSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="FlightSearchSoap" type="tns:FlightSearchSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Request">
<soap:operation soapAction="http://tempuri.org/Request" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CommRequest">
<soap:operation soapAction="http://tempuri.org/CommRequest" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="FlightSearchSoap12" type="tns:FlightSearchSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Request">
<soap12:operation soapAction="http://tempuri.org/Request" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CommRequest">
<soap12:operation soapAction="http://tempuri.org/CommRequest" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="FlightSearch">
<wsdl:port name="FlightSearchSoap" binding="tns:FlightSearchSoap">
<soap:address location="http://fltint.dev.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx"/>
</wsdl:port>
<wsdl:port name="FlightSearchSoap12" binding="tns:FlightSearchSoap12">
<soap12:address location="http://fltint.dev.sh.ctriptravel.com/FltIntlFlightSearchWebService/FlightSearch.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment