Example #1
0
        public override IMessage Invoke(IMessage msg)
        {
            var head = new Header()
            {
                Transaction = PaoTransaction.Current, UserToken = SecurityPublic.CurrentUser
            };
            var headString = RemotePublic.Serialize(head);

            IMethodCallMessage methodMessage = new MethodCallMessageWrapper((IMethodCallMessage)msg);
            var inArgs = methodMessage.InArgs;

            byte[] argString = null;
            if (!inArgs.IsNull())
            {
                argString = RemotePublic.Serialize(inArgs);
            }

            var resultBinary = RemoteService.CallService(RemotePublic.Serialize(ServiceName)
                                                         , RemotePublic.Serialize(methodMessage.MethodName)
                                                         , headString, argString);
            var result = RemotePublic.Deserialize <object>(resultBinary);

            // Create the return message (ReturnMessage)
            return(new ReturnMessage(result, null, 0, methodMessage.LogicalCallContext, methodMessage));
        }