Is there a way to generate an XML / JSON sample based on the WCF REST interface? In most cases, devices that consume our web services deserialize the message to the appropriate object. However, sometimes this is not possible, and so I need to send the developers the actual XML / JSON that they need to provide to the services and what the output looks like. Is there an easy way to generate this information, even if it uses default values ββfor data types?
Example webservice interface:
[OperationContract] [WebGet(UriTemplate = "Test", ResponseFormat = WebMessageFormat.Xml)] ResultOfAction Test(); // used to login [OperationContract] [WebInvoke(UriTemplate = "Login?", Method = "POST", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)] ResultOfAction Login(LoginRequest request); // register a client + forgot password [OperationContract] [WebInvoke(UriTemplate = "RequestOTP?", Method = "POST", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)] ResultOfAction RequestOTP(RequestOneTimePIN requestOneTimePin);
In the above example, I will need to see the XML file ResultOfAction, LoginRequest and RequestOneTimePIN. Is there an easy way to create such information?
Dylan source share