【发布时间】:2017-05-10 16:14:59
【问题描述】:
我正在尝试使用https://github.com/abelsilva/swaggerwcf
但是在我们的 WCF 方法中使用它时遇到问题
一个例子是这样的:
public ETemplate GetETemplate(int eTemplateId)
我们通过 webHttpBinding 暴露了 svc,并在行为中设置了 enableWebScript
当我们通常使用 REST 从 jQuery 访问它时,我们会在 Post 中使用它
{"eTemplateId": "26000"}
但是从 SwaggerWcf 生成的示例数据中,我们得到的只是一个像这样在 POST 中传递的整数
26000
下面是我如何在接口上装饰方法,我认为这是正确的,因为 WebMessageBodyStyle 正确设置为 Wrapped 而不是 Bare。
我错过了一些简单的东西吗?
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, Method = "POST",
RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
【问题讨论】:
标签: c# rest wcf swagger swagger-wcf