예제 #1
0
            private static Message CreateJsonObjectMessage(MessageVersion version, JsonValue detail)
            {
                string contentType = JsonValueFormatter.ApplicationJsonContentType + "; charset=utf-8";

                WebOperationContext.Current.OutgoingResponse.Headers.Remove(HttpResponseHeader.ContentType); // we need to force it to be JSON, even if it was set in the operation
                Message fault = StreamMessageHelper.CreateMessage(version, null, contentType, detail);

                return(fault);
            }
예제 #2
0
        public Message SerializeReply(MessageVersion messageVersion, object[] parameters, object result)
        {
            CheckMessageVersion(messageVersion);
            string contentType = string.Empty;

            if (result != null)
            {
                contentType = ApplicationJsonContentType + "; charset=" + this.charset;
            }

            Message reply = StreamMessageHelper.CreateMessage(
                messageVersion,
                this.operationDescription.Messages[1].Action,
                contentType,
                (JsonValue)result);

            return(reply);
        }