0

试图对 travelport 服务进行 wcf 调用。已添加了他们的 wsdl 文件。

问题是端点地址是“https”,当调用它时,它说 URi 模式需要 http .. 试图将绑定从 basicHttpBinding 更改为 wsHttpBinding 但它引发了另一个无法识别绑定类型的预期。

已尝试使用 http 方案使用相同的 Url,但该请求超时。

如果可以提供 TravelPort wcf 调用的任何特定教程,那将是一个很大的帮助。

示例代码如下(如果它可以提供任何帮助:))

PingReq req = new PingReq();

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

        PingRsp rsp = port.service(req);

问候,

4

1 回答 1

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

上面的示例代码对我有用。当您捕获异常时,您可能会得到一些代码,然后您可以向 TravelPort 人员询问发生这种情况的原因。这可能很简单,例如您的凭据被锁定。

于 2013-03-27T11:03:28.417 回答