首页 > 解决方案 > 如何在 ASMX Web 服务上从客户端接收 XML?

问题描述

我有一个 Web 服务 (ASMX),我希望我的代码能够从 Web 服务访问原始 XML。我怎么做?

[WebMethod]
public sendAttachmentResponse sendAttachments(sendAttachmentRequest request)
{

   /***********************************************************/
  // somewhere around here  I would like to be able to get the XML that was actually sent 
  // by the client, not the serialization of the "request" parameter
  /************************************************************/

  var response = new sendAttachmentResponse ();
  response.header = new responseHeader();
  try
  {
    using(var repo = new DB())
    {
      repo.SendAttachmentsRequest(request);
    }
    response.header.status = "OK";
  }
  catch(Exception ex)
  {
    response.header.status = "KO";
    response.header.errorCode = ex.HResult.ToString();
    response.header.errorDescription = ex.Message;
  }
  return response;
}

标签: c#asp.netasmxwebmethod

解决方案


推荐阅读