0

I have one method "CreateAccount" as mentioned below

[OperationContract]
[WebInvoke(UriTemplate = "CreateAccount", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
public CreateAccountServiceResponse CreateAccount(AuthenticateApplication Application, ApplicationCustomer Customer, CustomerService Service, Option Options)
{
    // Some Implementation
}

If I am using

BodyStyle = WebMessageBodyStyle.Wrapped

then I am not able to find Request/Response parameters in browser. Instead it is showing like

Message    direction    Format  Body
Request     Unknown     Cannot infer schema. The Request body is wrapped.
Response    Unknown     Cannot infer schema. The Response body is wrapped

screen shot

Can someone provide solution to this so that I can able to find request/response format.

Gaurav123
  • 5,059
  • 6
  • 51
  • 81
  • For seeing how your request/response looks, you can use [my answer to question _RESTful web service body format_](http://stackoverflow.com/questions/20206069/restful-web-service-body-format/20225936#20225936). – Konrad Kokosa Jul 11 '14 at 06:45
  • My requirement is to view request response in browser i.e. "http://72.5.167.17:8007/help" should show exact request and response. http://72.5.167.17:8007/CreateAccount – Gaurav123 Jul 11 '14 at 07:13

2 Answers2

0

Hosting it on IIS instead of using visual studio in-build server did the trick for me.

hemant gautam
  • 791
  • 8
  • 9
0

If you can wrap all of your inputs into a transport class, then you can remove the BodyStyle attribute, and everything will show up nicely.

ex.

public class CreateAccountServiceRequest {
    public AuthenticateApplication Application { get; set; }
    public ApplicationCustomer Customer { get; set; }
    public CustomerService Service { get; set; }
    public Option Options { get; set; }
}

[OperationContract]
[WebInvoke(UriTemplate = "CreateAccount", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public CreateAccountServiceResponse CreateAccount(CreateAccountServiceRequest request)
{
    // you can even reuse the existing method, as long as you don't expose it or change the UriTemplate so there's no conflict
    return CreateAccount(request.Application, request.Customer, request...
}
drzaus
  • 24,171
  • 16
  • 142
  • 201