private void Fail( TProtocol oprot, TMessage message, TApplicationException.ExceptionType extype, string etxt)
        {
            TApplicationException appex = new TApplicationException( extype, etxt);

            TMessage newMessage = new TMessage(message.Name, TMessageType.Exception, message.SeqID);

            oprot.WriteMessageBegin(newMessage);
            appex.Write( oprot);
            oprot.WriteMessageEnd();
            oprot.Transport.Flush();
        }
Exemple #2
0
            public void beginServiceDelivery_Process(int seqid, TProtocol iprot, TProtocol oprot)
            {
                beginServiceDelivery_args args = new beginServiceDelivery_args();

                args.Read(iprot);
                iprot.ReadMessageEnd();
                beginServiceDelivery_result result = new beginServiceDelivery_result();

                try
                {
                    try
                    {
                        iface_.beginServiceDelivery(args.ServiceID.Value, args.ServiceDeliveryToken, args.UnitsToSupply.Value);
                    }
                    catch (Worldpay.Innovation.WPWithin.Rpc.Types.Error err)
                    {
                        result.Err = err;
                    }
                    oprot.WriteMessageBegin(new TMessage("beginServiceDelivery", TMessageType.Reply, seqid));
                    result.Write(oprot);
                }
                catch (TTransportException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Error occurred in processor:");
                    Console.Error.WriteLine(ex.ToString());
                    TApplicationException x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                    oprot.WriteMessageBegin(new TMessage("beginServiceDelivery", TMessageType.Exception, seqid));
                    x.Write(oprot);
                }
                oprot.WriteMessageEnd();
                oprot.Transport.Flush();
            }
        public void notify_Process(int seqid, TProtocol iprot, TProtocol oprot)
        {
            notify_args args = new notify_args();

            args.Read(iprot);
            iprot.ReadMessageEnd();
            notify_result result = new notify_result();

            try
            {
                try
                {
                    iface_.notify(args.Event);
                }
                catch (UniversalNotificationServiceException e)
                {
                    result.E = e;
                }
                oprot.WriteMessageBegin(new TMessage("notify", TMessageType.Reply, seqid));
                result.Write(oprot);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                TApplicationException x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                oprot.WriteMessageBegin(new TMessage("notify", TMessageType.Exception, seqid));
                x.Write(oprot);
            }
            oprot.WriteMessageEnd();
            oprot.Transport.Flush();
        }
Exemple #4
0
        public void calculate_Process(int seqid, TProtocol iprot, TProtocol oprot)
        {
            calculate_args args = new calculate_args();

            args.Read(iprot);
            iprot.ReadMessageEnd();
            calculate_result result = new calculate_result();

            try
            {
                try
                {
                    result.Success = iface_.calculate(args.Logid, args.W);
                }
                catch (InvalidOperation ouch)
                {
                    result.Ouch = ouch;
                }
                oprot.WriteMessageBegin(new TMessage("calculate", TMessageType.Reply, seqid));
                result.Write(oprot);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                TApplicationException x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                oprot.WriteMessageBegin(new TMessage("calculate", TMessageType.Exception, seqid));
                x.Write(oprot);
            }
            oprot.WriteMessageEnd();
            oprot.Transport.Flush();
        }
Exemple #5
0
        public void lookupNearby_Process(int seqid, TProtocol iprot, TProtocol oprot)
        {
            lookupNearby_args args = new lookupNearby_args();

            args.Read(iprot);
            iprot.ReadMessageEnd();
            lookupNearby_result result = new lookupNearby_result();

            try
            {
                try
                {
                    result.Success = iface_.lookupNearby(args.Location, args.Category, args.Query, args.CountryAreaCode);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                oprot.WriteMessageBegin(new TMessage("lookupNearby", TMessageType.Reply, seqid));
                result.Write(oprot);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                TApplicationException x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                oprot.WriteMessageBegin(new TMessage("lookupNearby", TMessageType.Exception, seqid));
                x.Write(oprot);
            }
            oprot.WriteMessageEnd();
            oprot.Transport.Flush();
        }
        public void multiGetLastReadMessageIds_Process(int seqid, TProtocol iprot, TProtocol oprot)
        {
            multiGetLastReadMessageIds_args args = new multiGetLastReadMessageIds_args();

            args.Read(iprot);
            iprot.ReadMessageEnd();
            multiGetLastReadMessageIds_result result = new multiGetLastReadMessageIds_result();

            try
            {
                try
                {
                    result.Success = iface_.multiGetLastReadMessageIds(args.ChatIds);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                oprot.WriteMessageBegin(new TMessage("multiGetLastReadMessageIds", TMessageType.Reply, seqid));
                result.Write(oprot);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                TApplicationException x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                oprot.WriteMessageBegin(new TMessage("multiGetLastReadMessageIds", TMessageType.Exception, seqid));
                x.Write(oprot);
            }
            oprot.WriteMessageEnd();
            oprot.Transport.Flush();
        }
        public void fetchMessageOperations_Process(int seqid, TProtocol iprot, TProtocol oprot)
        {
            fetchMessageOperations_args args = new fetchMessageOperations_args();

            args.Read(iprot);
            iprot.ReadMessageEnd();
            fetchMessageOperations_result result = new fetchMessageOperations_result();

            try
            {
                try
                {
                    result.Success = iface_.fetchMessageOperations(args.LocalRevision, args.LastOpTimestamp, args.Count);
                }
                catch (TalkException e)
                {
                    result.E = e;
                }
                oprot.WriteMessageBegin(new TMessage("fetchMessageOperations", TMessageType.Reply, seqid));
                result.Write(oprot);
            }
            catch (TTransportException)
            {
                throw;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Error occurred in processor:");
                Console.Error.WriteLine(ex.ToString());
                TApplicationException x = new TApplicationException(TApplicationException.ExceptionType.InternalError, " Internal error.");
                oprot.WriteMessageBegin(new TMessage("fetchMessageOperations", TMessageType.Exception, seqid));
                x.Write(oprot);
            }
            oprot.WriteMessageEnd();
            oprot.Transport.Flush();
        }
Exemple #8
0
 public bool Process(TProtocol iprot, TProtocol oprot)
 {
     try
     {
         TMessage msg = iprot.ReadMessageBegin();
         ProcessFunction fn;
         this.processMap_.TryGetValue(msg.Name, out fn);
         if (fn == null)
         {
             TProtocolUtil.Skip(iprot, TType.Struct);
             iprot.ReadMessageEnd();
             var x = new TApplicationException(TApplicationException.ExceptionType.UnknownMethod,
                                               "Invalid method name: '" + msg.Name + "'");
             oprot.WriteMessageBegin(new TMessage(msg.Name, TMessageType.Exception, msg.SeqID));
             x.Write(oprot);
             oprot.WriteMessageEnd();
             oprot.Transport.Flush();
             return true;
         }
         fn(msg.SeqID, iprot, oprot);
     }
     catch (IOException)
     {
         return false;
     }
     return true;
 }