private void DesignatePrinter(String token) { DesignatePrinter.DesignatePrinterPortTypeClient client = DesignatePrinterService.returnClient(token); DesignatePrinter.MessageHeader message_header = DesignatePrinterService.returnMessageHeader(); DesignatePrinter.Security1 security = DesignatePrinterService.returnSecurityHeader(token); DesignatePrinter.DesignatePrinterRQ req = DesignatePrinterService.getRequest(token, "1"); SerializeAndShowWSResponse(req); System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; DesignatePrinter.DesignatePrinterRS response = null; try { response = client.DesignatePrinterRQ(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 void Call() { try { var request = new DesignatePrinterRQ() { POS = new DesignatePrinterRQPOS() { Source = new DesignatePrinterRQPOSSource() { PseudoCityCode = VolarisResources.PseudoCodeCity } }, Version = VolarisResources.DesignatePrinterServiceVersion }; request.Printers = new DesignatePrinterRQPrinters() { Ticket = new DesignatePrinterRQPrintersTicket() { CountryCode = VolarisResources.CountryCode, LineAddress = VolarisResources.LineAddres }, }; var service = new DesignatePrinterService() { MessageHeaderValue = this.GetMessageHeader(), SecurityValue = new Security() { BinarySecurityToken = this.SecurityToken } }; Serializer.Serialize("DesignatePrinterLLSRQ", request); var response = service.DesignatePrinterRQ(request); Serializer.Serialize("DesignatePrinterLLSRS", response); if (response.Success != null && response.Errors == null) { Success = true; } else { Success = false; ErrorMessage = "No se puedo terminer la transacción."; LogError(response.Errors.Error.ErrorMessage); } } catch (Exception exe) { Success = false; ErrorMessage = exe.Message; LogError(exe.Message); } }
public DesignatePrinterRS getDesignatePrinter(VO_PrintersTicketsRQ vo_PrintersTicketsRQ) { /*METODO PRINCICPAL QUE RETORNA EL OBJETO DE RESULTADOS DE SABRE*/ StringBuilder consulta = new StringBuilder(); clsParametros cParametros = new clsParametros(); cParametros.TipoWs = Enum_ProveedorWebServices.Sabre; DesignatePrinterRQ.DesignatePrinterRQ oDesignatePrinterRQ = new WS_SsoftSabre.DesignatePrinterRQ.DesignatePrinterRQ(); DesignatePrinterRS oDesignatePrinterRS = new DesignatePrinterRS(); objvo_Credentials = Ssoft.Utils.clsSesiones.getCredentials(); try { List <string> lsContadorOpciones = new List <string>(); DesignatePrinterRQ.MessageHeader Mensaje_ = clsSabreBase.DesignatePrinter(); if (Mensaje_ != null) { DesignatePrinterRQ.Security Seguridad_ = new DesignatePrinterRQ.Security(); Seguridad_.BinarySecurityToken = Session_; #region [ POS ] DesignatePrinterRQPOS oDesignatePrinterRQPOS = new DesignatePrinterRQPOS(); DesignatePrinterRQPOSSource oDesignatePrinterRQPOSSource = new DesignatePrinterRQPOSSource(); oDesignatePrinterRQPOSSource.PseudoCityCode = objvo_Credentials.Pcc;//ConfigurationManager.AppSettings["Sabre_Ipcc"]; oDesignatePrinterRQPOS.Source = oDesignatePrinterRQPOSSource; oDesignatePrinterRQ.POS = oDesignatePrinterRQPOS; #endregion #region [ VERSION ] oDesignatePrinterRQ.Version = clsSabreBase.SABRE_VERSION_DESIGNATEPRINTER; #endregion #region [ DESIGNATEPRINTERS ] DesignatePrinterRQPrinters oDesignatePrinterRQPrinters = new DesignatePrinterRQPrinters(); DesignatePrinterRQPrintersHardcopy oDesignatePrinterRQPrintersHardcopy = new DesignatePrinterRQPrintersHardcopy(); DesignatePrinterRQPrintersInvoiceItinerary oDesignatePrinterRQPrintersInvoiceItinerary = new DesignatePrinterRQPrintersInvoiceItinerary(); DesignatePrinterRQPrintersTicket oDesignatePrinterRQPrintersTicket = new DesignatePrinterRQPrintersTicket(); DesignatePrinterRQPrintersBoardingPass oDesignatePrinterRQPrintersBoardingPass = new DesignatePrinterRQPrintersBoardingPass(); oDesignatePrinterRQPrintersHardcopy.LineAddress = vo_PrintersTicketsRQ.PrtItinerario; oDesignatePrinterRQPrintersInvoiceItinerary.LineAddress = vo_PrintersTicketsRQ.PrtInvoice; oDesignatePrinterRQPrintersTicket.LineAddress = vo_PrintersTicketsRQ.PrtTicket; oDesignatePrinterRQPrintersTicket.CountryCode = vo_PrintersTicketsRQ.Countrycode; oDesignatePrinterRQPrinters.Hardcopy = oDesignatePrinterRQPrintersHardcopy; oDesignatePrinterRQPrinters.InvoiceItinerary = oDesignatePrinterRQPrintersInvoiceItinerary; oDesignatePrinterRQPrinters.Ticket = oDesignatePrinterRQPrintersTicket; oDesignatePrinterRQ.Printers = oDesignatePrinterRQPrinters; #endregion DesignatePrinterService oDesignatePrinterService = new DesignatePrinterService(); oDesignatePrinterService.MessageHeaderValue = Mensaje_; oDesignatePrinterService.SecurityValue = Seguridad_; oDesignatePrinterService.Url = objvo_Credentials.UrlWebServices; oDesignatePrinterRS = oDesignatePrinterService.DesignatePrinterRQ(oDesignatePrinterRQ); if (oDesignatePrinterRS.Errors != null) { cParametros.Id = 0; cParametros.Code = oDesignatePrinterRS.Errors.Error.ErrorCode; cParametros.Info = oDesignatePrinterRS.Errors.Error.ErrorInfo.Message; cParametros.Message = oDesignatePrinterRS.Errors.Error.ErrorMessage; cParametros.Severity = oDesignatePrinterRS.Errors.Error.Severity; cParametros.Complemento = "HostCommand: " + oDesignatePrinterRS.TPA_Extensions.HostCommand; cParametros.Metodo = "getDesignatePrinter"; cParametros.Tipo = clsTipoError.WebServices; consulta.AppendLine("Credenciales: "); try { if (objvo_Credentials != null) { consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc); consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc); consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber); consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio); consulta.AppendLine("Session Sabre: " + Session_.ToString()); consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices); } } catch { } cParametros.TargetSite = consulta.ToString(); try { clsCache cCache = new csCache().cCache(); if (cCache != null) { cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString(); } else { cParametros.Source = "Sesion Local: No hay cache "; } } catch { cParametros.Source = "Sesion Local: Error "; } ExceptionHandled.Publicar(cParametros); } else { cParametros.Id = 1; cParametros.Message = oDesignatePrinterRS.Success; cParametros.TipoLog = Enum_Error.Transac; consulta.AppendLine("Credenciales: "); try { if (objvo_Credentials != null) { consulta.AppendLine("User: "******"Password: "******"Ipcc: " + objvo_Credentials.Ipcc); consulta.AppendLine("Pcc: " + objvo_Credentials.Pcc); consulta.AppendLine("QNumber: " + objvo_Credentials.QNumber); consulta.AppendLine("Dominio: " + objvo_Credentials.Dominio); consulta.AppendLine("Session Sabre: " + Session_.ToString()); consulta.AppendLine("Url Sabre: " + objvo_Credentials.UrlWebServices); } } catch { } cParametros.TargetSite = consulta.ToString(); try { clsCache cCache = new csCache().cCache(); if (cCache != null) { cParametros.Source = "Sesion Local: " + cCache.SessionID.ToString(); } else { cParametros.Source = "Sesion Local: No hay cache "; } } catch { cParametros.Source = "Sesion Local: Error "; } cParametros.Metodo = "getBusqueda"; cParametros.Complemento = "HostCommand: " + oDesignatePrinterRS.TPA_Extensions.HostCommand; cParametros.Tipo = clsTipoError.WebServices; cParametros.Severity = clsSeveridad.Moderada; ExceptionHandled.Publicar(cParametros); } } } catch (Exception Ex) { cParametros.Id = 0; cParametros.Message = Ex.Message; cParametros.StackTrace = Ex.StackTrace; cParametros.Source = Ex.Source; cParametros.TargetSite = Ex.TargetSite.ToString(); cParametros.Severity = clsSeveridad.Alta; cParametros.Metodo = "getBusqueda"; cParametros.Tipo = clsTipoError.WebServices; ExceptionHandled.Publicar(cParametros); } return(oDesignatePrinterRS); }