我有一种方法" CreateAccount"如下所述
[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
}
如果我正在使用
BodyStyle = WebMessageBodyStyle.Wrapped
然后我无法在浏览器中找到请求/响应参数。相反,它显示为
Message direction Format Body
Request Unknown Cannot infer schema. The Request body is wrapped.
Response Unknown Cannot infer schema. The Response body is wrapped
有人可以为此提供解决方案,以便我能够找到请求/响应格式。
答案 0 :(得分:0)
在IIS上托管它而不是使用visual studio in-build服务器对我来说是个窍门。
答案 1 :(得分:0)
如果您可以将所有输入都包装到传输类中,那么您可以删除BodyStyle
属性,一切都会很好地显示。
离。
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...
}