【问题标题】:Sabre Air Availability Search Throws an exception (ERR.SWS.CLIENT.VALIDATION_FAILED)Sabre Air 可用性搜索引发异常 (ERR.SWS.CLIENT.VALIDATION_FAILED)
【发布时间】:2016-01-19 12:45:51
【问题描述】:

我在 C# 中使用 Sabre SOAP Api。我成功获得了会话创建的响应,我将 wsdl 服务参考 http://webservices.sabre.com/wsdl/tpfc/OTA_AirAvailLLS2.3.0RQ.wsdl 添加到我的测试项目中,并将所需的值传递给文档https://developer.sabre.com/docs/read/soap_apis/air/search/Air_Availability 中给出的请求中的参数。

这是我使用 SOAP API 的代码

public OTA_AirAvailRS Method(string securitytoken, string convid, string ipcc)
        {
            try
            {

                DateTime dt = DateTime.UtcNow;
                string tstamp = dt.ToString("s") + "Z";

                //Create the message header. Provide the value for the conversation ID, the action code of the Web
                //service being called, and the value for wsse:BinarySecurityToken that was returned with
                //the SessionCreateRS message.
                //This sample calls the OTA_AirAvailLLSRQ Service, and the action code that corresponds to 
                //this service is OTA_AirAvailLLSRQ.

                MessageHeader msgHeader = new MessageHeader();
                msgHeader.ConversationId = convid;      // Put ConversationId in req header

                From from = new From();
                PartyId fromPartyId = new PartyId();
                PartyId[] fromPartyIdArr = new PartyId[1];
                fromPartyId.Value = "WebServiceClient";
                fromPartyIdArr[0] = fromPartyId;
                from.PartyId = fromPartyIdArr;
                msgHeader.From = from;

                To to = new To();
                PartyId toPartyId = new PartyId();
                PartyId[] toPartyIdArr = new PartyId[1];
                toPartyId.Value = "WebServiceSupplier";
                toPartyIdArr[0] = toPartyId;
                to.PartyId = toPartyIdArr;
                msgHeader.To = to;

                msgHeader.CPAId = ipcc;
                msgHeader.Action = "OTA_AirAvailLLSRQ";
                Service service = new Service();
                service.Value = "AirAvail";
                msgHeader.Service = service;


                MessageData msgData = new MessageData();
                msgData.MessageId = "mid:20001209-133003-2333@clientofsabre.com1";
                msgData.Timestamp = tstamp;
                msgHeader.MessageData = msgData;
                Security1 security = new Security1();
                security.BinarySecurityToken = securitytoken;   // Put BinarySecurityToken in req header

                //Create the request object req and the value for the IPCC in the payload of the request.

                OTA_AirAvailRQOriginDestinationInformationFlightSegment seg = new OTA_AirAvailRQOriginDestinationInformationFlightSegment()
                {
                    ArrivalDateTime = "12-21T19:00",
                    DepartureDateTime = "12-21T18:00",
                    DestinationLocation = new OTA_AirAvailRQOriginDestinationInformationFlightSegmentDestinationLocation() { LocationCode = "DFW" },
                    OriginLocation = new OTA_AirAvailRQOriginDestinationInformationFlightSegmentOriginLocation() { LocationCode = "HNL" }
                };

                OTA_AirAvailRQ req = new OTA_AirAvailRQ();
                req.OriginDestinationInformation = new OTA_AirAvailRQOriginDestinationInformation() { FlightSegment = seg };
               // req.TimeStamp = tstamp;
               // req.OptionalQualifiers.FlightQualifiers.
                req.Version="2.3.0";

                OTA_AirAvailPortTypeClient c = new OTA_AirAvailPortTypeClient();
                OTA_AirAvailRS resp = c.OTA_AirAvailRQ(ref msgHeader, ref security, req);
                return resp;
            }
            catch (Exception e)
            {
                Console.WriteLine("The file could not be read:");
                Console.WriteLine("Exception Stack Trace : " + e.StackTrace);

            }
            return new OTA_AirAvailRS();
        }

它抛出异常消息:ERR.SWS.CLIENT.VALIDATION_FAILED

堆栈:

服务器堆栈跟踪:

在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime 操作,ProxyRpc& rpc) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串动作, Boolean oneway, ProxyOperationRuntime 操作, Object[] ins, Object[] 出局,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime 操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 留言)

在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(消息数据& msgData,Int32 类型)在 ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortType.OTA_AirAvailRQ(OTA_AirAvailRQRequest 请求)在 ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortTypeClient.ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortType.OTA_AirAvailRQ(OTA_AirAvailRQRequest 请求)在 e:\ConsoleApplication1\ConsoleApplication1\Service References\ServiceAirAvailLLSReference1\Reference.cs:line 7012 at ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortTypeClient.OTA_AirAvailRQ(MessageHeader& MessageHeader, Security1& Security, OTA_AirAvailRQ OTA_AirAvailRQ1) 在 e:\ConsoleApplication1\ConsoleApplication1\Service References\ServiceAirAvailLLSReference1\Reference.cs:line 7020 at ConsoleApplication1.SearchAirAvail.Method(字符串安全令牌,字符串 convid, 字符串 ipcc) 在 e:\ConsoleApplication1\ConsoleApplication1\SearchAirAvail.cs:第 115 行

请帮帮我

【问题讨论】:

  • 生成的 XML 请求似乎有问题。我建议您打印出发送到服务器的确切 XML 请求,并尝试在 Soap 客户端(如 SoapUI 或其他几个客户端)中使用它。将请求粘贴到此处,还可以让社区更轻松地帮助您解决特定问题。
  • 同意 MC。发布 SOAP API 的序列化 XML 请求和响应使故障排除更加容易。

标签: web-services soap air wsdl sabre


【解决方案1】:

我找到了这个问题的答案.. 只是评论 //ArrivalDateTime = "12-21T19:00"

请求不需要此字段

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-21
    • 2015-06-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多