2013-03-21 109 views
0

嘗試對travelport Service進行wcf調用。已添加他們的wsdl文件。TravelPort WCF呼叫問題

問題是端點地址是「https」,當調用它時,它表示URi模式期望http ..試圖將Binding從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); 

問候,

回答

1
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夥伴們詢問爲什麼那麼受歡迎。這可能很簡單,就像您的憑證被鎖定一樣。

+0

謝謝你的回答。尚未測試它,因爲Travelport集成暫時被推遲..但是,謝謝你的時間:) – 2013-04-08 10:52:24

+0

非常感謝!我遍歷整個互聯網試圖使我的請求工作 - 然後它似乎我使用了一個錯誤的URL。 Travelport的uAPI測試實用程序+ Fiddler2確實幫助我。 – 2013-06-06 12:16:56

+0

@ArmanBimatov很高興它幫助你.. – 2013-06-06 15:11:22