Ejemplo n.º 1
0
 public OTA2009A_ReadReservationsSoapClient(EndpointConfiguration endpointConfiguration) :
     base(OTA2009A_ReadReservationsSoapClient.GetBindingForEndpoint(endpointConfiguration), OTA2009A_ReadReservationsSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Ejemplo n.º 2
0
 public OTA2009A_ReadReservationsSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(OTA2009A_ReadReservationsSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var client = new OTA2009A_ReadReservationsSoapClient(OTA2009A_ReadReservationsSoapClient.EndpointConfiguration.OTA2009A_ReadReservationsSoap);

            client.Open();

            var readRequest = new OTA_ReadRQ
            {
                Version        = 1,
                SchemaLocation = "http://www.opentravel.org/OTA/2003/05 OTA_ReadRQ.xsd",
                EchoToken      = "34267",
                TimeStamp      = DateTime.Now,
                Target         = MessageAcknowledgementTypeTarget.Test,
                POS            = new System.Collections.Generic.List <SourceType>
                {
                    new SourceType
                    {
                        AgentDutyCode = "FERATEL"
                    }
                },
                ReadRequests = new OTA_ReadRQReadRequests
                {
                    Items = new System.Collections.Generic.List <object>
                    {
                        new OTA_ReadRQReadRequestsHotelReadRequest
                        {
                            HotelCode         = "SIMSIM",
                            SelectionCriteria = new System.Collections.Generic.List <OTA_ReadRQReadRequestsHotelReadRequestSelectionCriteria>
                            {
                                new OTA_ReadRQReadRequestsHotelReadRequestSelectionCriteria
                                {
                                    DateType = OTA_ReadRQReadRequestsHotelReadRequestSelectionCriteriaDateType.LastUpdateDate,
                                    Start    = "2017-04-01",
                                    End      = "2017-04-01",
                                }
                            }
                        }
                    }
                }
            };

            var serializer = new XmlSerializer(typeof(OTA_ReadRQ));
            var encoding   = Encoding.ASCII;
            XmlWriterSettings xmlWriterSettings = new XmlWriterSettings
            {
                Indent             = false,
                OmitXmlDeclaration = true,
                Encoding           = encoding
            };

            using (var stream = new MemoryStream())
            {
                using (var xmlWriter = XmlWriter.Create(stream, xmlWriterSettings))
                {
                    serializer.Serialize(xmlWriter, readRequest);
                }

                var response = client.GetResponseAsync(encoding.GetString(stream.ToArray())).Result;
                Console.WriteLine(response.Body.GetResponseResult);
                Console.ReadKey();
            }

            client.Close();
        }