自动处理PNR,使用DesignatePrinter

时间:2016-03-24 09:21:06

标签: sabre

目前我正在创建一个票务机器人。作为流程的一部分,就像在Galileo中一样,我需要将票务打印机“链接”到我当前的连接/会话,然后才能发送票务请求。

然而,关于如何形成我的DesignatePrinter请求,文档并不十分清楚。

目前我正以下列方式这样做:

var messageHeader = new MessageHeader
{
    ConversationId = "TestSession",
    CPAId = licenseId,
    Action = "DesignatePrinterLLSRQ",
    Service = new Service { Value = "DesignatePrinterLLSRQ" },
    MessageData = new MessageData
    {
        MessageId = "xxx:xxxxxx",
        Timestamp = DateTime.UtcNow.ToString("s") + "Z"
    },
    From = new From()
    {
        PartyId = new[]
        {
            new PartyId {Value = "WebServiceClient"}
        }
    },
    To = new To()
    {
        PartyId = new[]
        {
            new PartyId {Value = "WebServiceSupplier"}
        }
    }
};

由于我的想法是票,我将一个DesignatePrinterRQPrintersTicket分配给请求对象,如下所示:

var request = new   
{
    Version = "2.25.0",
    TimeStamp = DateTime.UtcNow,
    TimeStampSpecified = true,
    Printers = new DesignatePrinterRQPrinters
    {
        Ticket = new DesignatePrinterRQPrintersTicket { LNIATA = printers }
    }
};

DesignatePrinterRS resp = null;
Policy.Handle<SoapException>()
    .Or<WebException>()
    .WaitAndRetry(new[]
    {
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(1)
    })
    .Execute(() =>
    {
        using (
            DesignatePrinterService serviceObj = new DesignatePrinterService())
        {
            serviceObj.MessageHeaderValue = messageHeader;
            serviceObj.Security = new Security1 { BinarySecurityToken = token };
            resp = serviceObj.DesignatePrinterRQ(request);
        }
    });

if (resp != null && resp.ApplicationResults.status == CompletionCodes.Complete)
{
    //  Ticket printer linked
    resultValue = 1;
}
else
{
    //  Ticket printer not linked
    resultValue = 0;
}

这是否足够,还是需要更多?

不幸的是,我现在无法进行测试......

1 个答案:

答案 0 :(得分:0)

你可以发布生成的输出XML吗?

通常情况下,使用DesignatePrinterLLSRQ请求指定票据打印机会起作用:

 <soapenv:Body>
      <ns:DesignatePrinterRQ ReturnHostCommand="true" Version="2.0.1">
         <ns:Printers>
            <ns:Ticket CountryCode="countryTicketPrinterTypeCodeHere" LNIATA="printerLineAddressHere" />
         </ns:Printers>
      </ns:DesignatePrinterRQ>
   </soapenv:Body>

您需要Sabre提供CountryCode和LNIATA的值。 您可以使用以下联系方式联系Sabre:https://developer.sabre.com/contact

有关DesignatePrinterLLSRQ服务的相关Saber命令的信息,请访问:https://formatfinder.sabre.com/Content/Printers/TicketPrinter/PrinterTicket.aspx?LanguageOverride=en&ItemID=38722B8FF6C949189864DF2641F867ED

(登录参数 - &gt;代理登录:您的SOAP API用户名/密码:您的Sabre API密码/ PCC:您的Sabre API'组织')