【发布时间】:2017-02-28 07:33:24
【问题描述】:
我正在尝试通过 swagger 调用服务,方法是传递 XML 格式的参数。
方法在命中,但传入的参数为空
表示“xlff”为空白。你知道我在做什么错吗
/// <summary>
/// Get or insert blog comments which is approved based on blogs
/// </summary>
/// <remarks> Get or insert blog comments which is approved based on blogs</remarks>
/// <param name="xlf">The comment.</param>
/// <response code="200">Get approved blog comments</response>
/// <response code="404">Not found</response>
/// <returns>IHttpActionResult</returns>
[Route("api/smartling/ProcessSmartlingTranslation")]
[VersionedRoute("", 1)]
[ResponseType(typeof(HttpResponseMessage))]
[HttpPost]
public IHttpActionResult ProcessSmartlingTranslation([FromBody]xliff xlff)
{
return Content(HttpStatusCode.BadRequest, "Any object");
}
/// <summary>
/// XliffModel created
/// </summary>
public class xliff
{
/// <summary>
/// file getter setter method
/// </summary>
public string file { get; set; }
/// <summary>
/// body getter setter method
/// </summary>
public string body { get; set; }
}
【问题讨论】:
-
客户端代码也很有用
-
我正在使用 swagger 为什么需要客户端?
-
这可能是因为无法反序列化您发送的 XML。您是否检查了
xliff是否与您发送的 XML 模式兼容? -
所以显示你如何调用这个 api。或者你在招摇中的定义
-
如何检查?
标签: c# .net asp.net-web-api swagger