private void SendSabreCommand(String token) { SabreCommand.SabreCommandLLSPortTypeClient client = SabreCommandRequest.returnClient(token); SabreCommand.MessageHeader message_header = SabreCommandRequest.returnMessageHeader(); SabreCommand.Security security = SabreCommandRequest.returnSecurityHeader(token); // this line is to use TLS 1.2 otherwise it cannot connect to the end point System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; SabreCommand.SabreCommandLLSRS response; //string command = txtCommand.Text.ToUpper(); string command = "0HHTHIGK1JFKIN07JUL-OUT08JUL/HOLIDAY INN/DBLB/65.00USD/G/SI-" + Util.CHGKEY + "1900 VAN WYKE¥S OZONE PARK NY 10405¥FONE 212-555-1957¤REQUESTED SUITE/CF-62FE77"; SabreCommand.SabreCommandLLSRQ req = SabreCommandRequest.getRequest(token, command); SerializeAndShowWSResponse(req); try { response = client.SabreCommandLLSRQ(ref message_header, ref security, req); SerializeAndShowWSResponse(response); } catch (Exception e) { MessageBox.Show(e.StackTrace + "\"" + e.Message); Debug.Write(e.StackTrace); Debug.Write(e.Message); } finally { } }
public static SabreCommand.MessageHeader returnMessageHeader() { SabreCommand.MessageHeader message_header = new SabreCommand.MessageHeader(); DateTime now = DateTime.Now; // from SabreCommand.From from = new SabreCommand.From(); SabreCommand.PartyId fromPartyId = new SabreCommand.PartyId(); SabreCommand.PartyId[] fromPartyIdArr = new SabreCommand.PartyId[1]; fromPartyId.Value = "WebServiceClient"; fromPartyIdArr[0] = fromPartyId; from.PartyId = fromPartyIdArr; message_header.From = from; // to SabreCommand.To to = new SabreCommand.To(); SabreCommand.PartyId toPartyId = new SabreCommand.PartyId(); SabreCommand.PartyId[] toPartyIdArr = new SabreCommand.PartyId[1]; toPartyId.Value = "WebServiceSupplier"; toPartyIdArr[0] = toPartyId; to.PartyId = toPartyIdArr; message_header.To = to; message_header.Action = "SabreCommandLLSRQ"; message_header.CPAId = "IPCC"; SabreCommand.Service service = new SabreCommand.Service(); service.Value = "SabreCommandLLSRQ"; message_header.Service = service; SabreCommand.MessageData message_data = new SabreCommand.MessageData(); message_data.MessageId = "2529036674227040150"; message_data.RefToMessageId = "mid:[email protected]"; message_data.Timestamp = now.ToString(); message_header.MessageData = message_data; // conversation id seems to accept a timestamp message_header.ConversationId = now.ToLongDateString(); return(message_header); }