/// <summary> /// Libera conexiones y sesiones de sabre /// </summary> public void Dispose() { try { if (!this.isConnected) { return; } serviceClose.MessageHeader msgHeader = this.GetCloseMessageHeader(); serviceClose.Security security = new serviceClose.Security(); security.BinarySecurityToken = this.SecurityToken; // Put BinarySecurityToken in req header serviceClose.SessionCloseRQ req = new serviceClose.SessionCloseRQ(); serviceClose.SessionCloseRQPOS pos = new serviceClose.SessionCloseRQPOS(); serviceClose.SessionCloseRQPOSSource source = new serviceClose.SessionCloseRQPOSSource(); source.PseudoCityCode = this.IPcc; pos.Source = source; req.POS = pos; serviceClose.SessionCloseRQService serviceObj = new serviceClose.SessionCloseRQService(); serviceObj.MessageHeaderValue = msgHeader; serviceObj.SecurityValue = security; serviceClose.SessionCloseRS resp = serviceObj.SessionCloseRQ(req); // Send the request } catch (Exception e) { } }
/// <summary> /// Obtiene la cabecera para cerrar mensaje enviado por /// los servicios de sabre /// </summary> /// <returns>Cabecera para que cierra conexción</returns> private serviceClose.MessageHeader GetCloseMessageHeader() { DateTime dt = DateTime.UtcNow; string tstamp = dt.ToString("s") + "Z"; serviceClose.MessageHeader msgHeader = new serviceClose.MessageHeader(); msgHeader.ConversationId = this.ConversationId; // Set the ConversationId serviceClose.From from = new serviceClose.From(); serviceClose.PartyId fromPartyId = new serviceClose.PartyId(); serviceClose.PartyId[] fromPartyIdArr = new serviceClose.PartyId[1]; fromPartyId.Value = "99999"; fromPartyIdArr[0] = fromPartyId; from.PartyId = fromPartyIdArr; msgHeader.From = from; serviceClose.To to = new serviceClose.To(); serviceClose.PartyId toPartyId = new serviceClose.PartyId(); serviceClose.PartyId[] toPartyIdArr = new serviceClose.PartyId[1]; toPartyId.Value = "123123"; toPartyIdArr[0] = toPartyId; to.PartyId = toPartyIdArr; msgHeader.To = to; msgHeader.CPAId = ipcc; msgHeader.Action = "SessionCloseRQ"; serviceClose.Service service = new serviceClose.Service(); service.Value = "SessionClose"; msgHeader.Service = service; serviceClose.MessageData msgData = new serviceClose.MessageData(); msgData.MessageId = "mid:[email protected]"; msgData.Timestamp = tstamp; msgHeader.MessageData = msgData; return(msgHeader); }