Esempio n. 1
0
        public Message SerializeReply(MessageVersion messageVersion, object[] parameters, object result)
        {
            JsonRpcResponse <object> jsonResponse = CreateResponse(result);
            Encoding encoding = GetResponseMessageEncoding();

            byte[] rawBody = DispatcherUtils.SerializeBody(jsonResponse, encoding);

            return(DispatcherUtils.CreateMessage(messageVersion, _responseMessage.Action, rawBody, encoding));
        }
        public Message SerializeRequest(MessageVersion messageVersion, object[] parameters)
        {
            JsonRpcRequest jsonRequest = CreateRequest(parameters);

            byte[] rawBody = DispatcherUtils.SerializeBody(jsonRequest, Encoding.UTF8);

            Message requestMessage = DispatcherUtils.CreateMessage(
                messageVersion, _requestMessage.Action, rawBody, Encoding.UTF8);

            requestMessage.Headers.To = _endpoint.Address.Uri;
            requestMessage.Properties.Add(DispatcherUtils.OperationNameKey, _operation.Name);

            return(requestMessage);
        }