Exemplo n.º 1
0
        public async void Call(IWampClient client, string callId, string procUri, params TMessage[] arguments)
#endif
        {
            procUri = ResolveUri(client, procUri);

            IWampRpcMethod method = mRpcMetadataCatalog.ResolveMethodByProcUri(procUri);

            try
            {
                WampRequestContext.Current = new WampRequestContext(client);

                object[] parameters =
                    arguments.Zip(method.Parameters,
                                  (argument, type) =>
                                  mFormatter.Deserialize(type, argument))
                    .ToArray();

#if !NET45
                InnerCall(client, callId, method.InvokeAsync(client, parameters));
            }
#else
                object result = await method.InvokeAsync(client, parameters).ConfigureAwait(false);

                client.CallResult(callId, result);
            }
Exemplo n.º 2
0
        public async void Call(IWampClient client, string callId, string procUri, params TMessage[] arguments)
        {
            procUri = ResolveUri(client, procUri);

            IWampRpcMethod method = mRpcMetadataCatalog.ResolveMethodByProcUri(procUri);

            try
            {
                WampRequestContext.Current = new WampRequestContext(client);

                object[] parameters =
                    arguments.Zip(method.Parameters,
                                  (argument, type) =>
                                  mFormatter.Deserialize(type, argument))
                    .ToArray();

                object result = await method.InvokeAsync(client, parameters).ConfigureAwait(false);

                client.CallResult(callId, result);
            }
            catch (Exception ex)
            {
                HandleException(client, callId, ex);
            }
            finally
            {
                WampRequestContext.Current = null;
            }
        }