KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been working on getting a RESTful WCF service to both accept a JSON as a parameter and return some JSON. This is my service: [OperationContract] [WebInvoke( Method="POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "Authenticate")] public AuthResponse Authenticate(AuthRequest data) { AuthResponse res = new AuthResponse(); if (data != null) { Debug.WriteLine(data.TokenId); res.TokenId = new Guid(data.TokenId); } return res; } The above will set data to be null when I pass { AuthRequest: { TokenId = "some guid"} }. If I set the BodyStyle of the method to be Bare then data is set correctly but I must remove { AuthRequest } from the JSON (which I don't really want to do). Is there any way to get WrappedRequests to work with { AuthRequest: { TokenId = "some guid"} as the JSON? Thanks.
Tags (comma-separated)
Save Edits
Cancel