简体   繁体   中英

TravelPort WCF call issue

Trying to make a wcf call to travelport Service .. Have added their wsdl file .

The issue is that the endpoint address is "https" and when calling that, its says the URi schema expects http .. tried to change the Binding from basicHttpBinding to wsHttpBinding but it raises another expection of binding type not recognized..

Have tried the same Url with http scheme but that request Times out.

If any specific tutorial to TravelPort wcf call can be provided that that would be a great favor..

The sample code is as under (if it can be of any help :) )

PingReq req = new PingReq();

        req.Payload = "Payload";
        req.TraceId = "abcd";
        SystemPingPortTypeClient port = new SystemPingPortTypeClient();

        PingRsp rsp = port.service(req);

Regards,

    LowFareSearchReq req = new LowFareSearchReq();
    req.TargetBranch = "{EnterBranchCode}";
    req.AuthorizedBy = "test";

    BillingPointOfSaleInfo biPOS = new BillingPointOfSaleInfo();
    biPOS.OriginApplication = "uAPI";
    req.BillingPointOfSaleInfo = biPOS;

    //from LHR to BOM
    SearchAirLeg airLeg = new SearchAirLeg();            
    Airport fromAirPort = new Airport() { Code = "LHR" };
    typeSearchLocation fromTypLoc = new typeSearchLocation(){Item=fromAirPort};
    airLeg.SearchOrigin = new typeSearchLocation[1] { fromTypLoc };
    Airport toAirPort = new Airport() { Code = "BOM" };
    typeSearchLocation toTypLoc = new typeSearchLocation() { Item = toAirPort };
    airLeg.SearchDestination = new typeSearchLocation[1] { toTypLoc };
    typeTimeSpec origDep = new typeTimeSpec() { PreferredTime = "2013-05-24" };
    airLeg.Items = new typeTimeSpec[1] { origDep };


    //from BOM to LHR
    SearchAirLeg returnAirLeg = new SearchAirLeg();
    Airport fromAirPort1 = new Airport() { Code = "BOM" };
    typeSearchLocation fromTypLoc1 = new typeSearchLocation() { Item = fromAirPort1 };
    returnAirLeg.SearchOrigin = new typeSearchLocation[1] { fromTypLoc1 };
    Airport toAirPort1 = new Airport() { Code = "LHR" };
    typeSearchLocation toTypLoc1 = new typeSearchLocation() { Item = toAirPort1 };
    returnAirLeg.SearchDestination = new typeSearchLocation[1] { toTypLoc1 };
    typeTimeSpec destDep = new typeTimeSpec() { PreferredTime = "2013-05-27" };
    returnAirLeg.Items = new typeTimeSpec[1] { destDep };

    req.Items = new object[] { airLeg, returnAirLeg };

    //modifiers
    AirSearchModifiers airSearchMod = new AirSearchModifiers()
    {
      DistanceType = typeDistance.MI,
      IncludeFlightDetails = true,
      PreferNonStop = true,
      MaxSolutions = "300",
      PreferredProviders = new Provider[1] {new Provider(){ Code = "1G" }}              
    };
    AirPricingModifiers airPriceMod = new AirPricingModifiers()
    {
      FiledCurrency = "GBP"
    };
    req.AirSearchModifiers = airSearchMod;
    req.AirPricingModifiers = airPriceMod;
    //passenger details
    SearchPassenger pass1 = new SearchPassenger() { Code = "ADT" };
    SearchPassenger pass2 = new SearchPassenger() { Code = "ADT" };

    req.SearchPassenger = new SearchPassenger[] { pass1, pass2 };


    //reponse
    LowFareSearchRsp res= new LowFareSearchRsp();

    AirLowFareSearchPortTypeClient cli = new AirLowFareSearchPortTypeClient("AirLowFareSearchPort");
    cli.ClientCredentials.UserName.UserName = "Enter User Name";
    cli.ClientCredentials.UserName.Password = "Enter Password";

    res = cli.service(req);

The Sample code above works for me. When you catch the Exception you might get some code which you can then ask TravelPort guys the reason why that happned as well. It might be simple thing like your credentials are locked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM