static public void OTA_NotifReportRQ(string usernameAuthenticate, string passwordAuthenticate) { PmsXchangeServiceClient service = new PmsXchangeServiceClient(); OTA_NotifReportRQ otaRequestBody = new OTA_NotifReportRQ(); service.NotifReportRQ(CreateSecurityHeader(usernameAuthenticate, passwordAuthenticate), otaRequestBody); }
public void InitializeService() { BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.Transport; EndpointAddress address = new EndpointAddress(endpointURI); service = new PmsXchangeServiceClient(binding, address); }
static public OTA_ResRetrieveRS OTA_ReadRQ(string pmsID, string usernameAuthenticate, string passwordAuthenticate, string hotelCode, ResStatus resStatus) { PmsXchangeServiceClient service = ServiceConnection.Instance.service; pmsXchangeService.OTA_ReadRQ readRequestBody = new OTA_ReadRQ(); readRequestBody.Version = 1.0M; readRequestBody.EchoToken = Guid.NewGuid().ToString(); // Echo token must be unique. readRequestBody.TimeStamp = DateTime.Now; readRequestBody.TimeStampSpecified = true; readRequestBody.POS = CreatePOS(pmsID); pmsXchangeService.OTA_ReadRQReadRequests readRequests = new pmsXchangeService.OTA_ReadRQReadRequests(); pmsXchangeService.OTA_ReadRQReadRequestsHotelReadRequest hotelReadRequest = new pmsXchangeService.OTA_ReadRQReadRequestsHotelReadRequest(); hotelReadRequest.HotelCode = hotelCode; readRequests.Items = new object[] { hotelReadRequest }; OTA_ReadRQReadRequestsHotelReadRequestSelectionCriteria selectionCriteria = new pmsXchangeService.OTA_ReadRQReadRequestsHotelReadRequestSelectionCriteria(); selectionCriteria.SelectionType = pmsXchangeService.OTA_ReadRQReadRequestsHotelReadRequestSelectionCriteriaSelectionType.Undelivered; selectionCriteria.SelectionTypeSpecified = true; // Must be set to true, or ReadRQ returns an error. if (resStatus != ResStatus.All) { selectionCriteria.ResStatus = Enum.GetName(typeof(ResStatus), resStatus); } hotelReadRequest.SelectionCriteria = selectionCriteria; readRequestBody.ReadRequests = readRequests; // // Send a retrieve reservations request. // return(service.ReadRQ(CreateSecurityHeader(usernameAuthenticate, passwordAuthenticate), readRequestBody)); }
static public async Task <PingRQResponse> OTA_PingRS(string usernameAuthenticate, string passwordAuthenticate) { PingRQResponse response = null; try { PmsXchangeServiceClient service = ServiceConnection.Instance.service; pmsXchangeService.OTA_PingRQ pingRequestBody = new pmsXchangeService.OTA_PingRQ(); pingRequestBody.Version = 1.0M; pingRequestBody.EchoToken = Guid.NewGuid().ToString(); // Echo token must be unique. pingRequestBody.TimeStamp = DateTime.Now; pingRequestBody.TimeStampSpecified = true; pingRequestBody.EchoData = "good echo"; int q = 0; int h = 7 / q; // // Send an asynchronous ping request. // response = await service.PingRQAsync(CreateSecurityHeader(usernameAuthenticate, passwordAuthenticate), pingRequestBody); } catch (Exception ex) { response = new PingRQResponse(); ErrorsType errors = new ErrorsType(); ErrorType [] err1 = new ErrorType[1]; err1[0] = new ErrorType(); err1[0].Type = EWT.Processing_exception.ToString(); err1[0].Value = ex.Message; response.OTA_PingRS = new OTA_PingRS(); response.OTA_PingRS.Items = new object[] { errors }; } return(response); }