0

C# でセイバー SOAP API を使用しています。セッション作成からの応答を正常に取得しました。wsdl Service Reference 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 (文字列アクション、ブール値一方向、ProxyOperationRuntime 操作、Object[] ins、Object[] outs、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(MessageData& msgData, Int32 タイプ) で ConsoleApplication1.ServiceAirAvailLLSReference1. OTA_AirAvailPortType.OTA_AirAvailRQ(OTA_AirAvailRQRequest request) at ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortTypeClient.ConsoleApplication1.ServiceAirAvailLLSReference1.OTA_AirAvailPortType.OTA_AirAvailRQ(OTA_AirAvailRQRequest request) in 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(String securitytoken, String convid, String ipcc) in e:\ConsoleApplication1\ConsoleApplication1\SearchAirAvail.cs: 115行目

私を助けてください

4

1 に答える 1

3

私はこの質問の答えを見つけました.. //ArrivalDateTime = "12-21T19:00"とコメントするだけです

このフィールドはリクエストには必須ではありません

于 2016-01-20T14:13:43.850 に答える