Sabre Air Availability Search引发异常(ERR.SWS.CLIENT.VALIDATION_FAILED)

时间:2016-01-19 12:45:51

标签: web-services soap air wsdl sabre

我在C#中使用Saber 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

Stack:

服务器堆栈跟踪:

  

在   System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime   操作,ProxyRpc& rpc)at   System.ServiceModel.Channels.ServiceChannel.Call(String action,   Boolean oneway,ProxyOperationRuntime操作,Object [] ins,   对象[]出局,TimeSpan超时)at   System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage   methodCall,ProxyOperationRuntime operation)at   System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天   消息)

     

在[0]处重新抛出异常:at   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天   reqMsg,IMessage retMsg)at   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培;   msgData,Int32类型)at   ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortType.OTA_AirAvailRQ(OTA_AirAvailRQRequest   请求)   ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortTypeClient.ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortType.OTA_AirAvailRQ(OTA_AirAvailRQRequest   请求)在e:\ ConsoleApplication1 \ ConsoleApplication1 \ Service中   参考文献\ ServiceAirAvailLLSReference1 \ Reference.cs:第7012行   ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortTypeClient.OTA_AirAvailRQ(的MessageHeader&安培;   MessageHeader,Security1&安全,OTA_AirAvailRQ OTA_AirAvailRQ1)in   E:\ ConsoleApplication1 \ ConsoleApplication1 \服务   引用\ ServiceAirAvailLLSReference1 \ Reference.cs:第7020行   ConsoleApplication1.SearchAirAvail.Method(String securitytoken,String   convid,String ipcc)in   e:\ ConsoleApplication1 \ ConsoleApplication1 \ SearchAirAvail.cs:第115行

请帮帮我

1 个答案:

答案 0 :(得分:3)

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

请求

不需要此字段