是否有一种方式来获得从一个ASP.NET WebMethod的原始SOAP请求?有一种、原始、方式、NET

2023-09-02 10:40:08 作者:龙卷风

例如:

 公共类服务1:System.Web.Services.WebService
{
   [WebMethod的]
   公众诠释添加(INT X,int y)对
   {
       字符串请求= getRawSOA prequest(); //你怎么能实现这部分?
       // ..做一些完整的SOAP请求

       INT总和= X + Y;
       返回总和;
   }
}
 

解决方案

是的,你可以使用SoapExtensions做到这一点。下面是一个贯穿始终的过程不错的文章。

Example:

public class Service1 : System.Web.Services.WebService
{
   [WebMethod]
   public int Add(int x, int y)
   {
       string request = getRawSOAPRequest();//How could you implement this part?
       //.. do something with complete soap request

       int sum = x + y;
       return sum;
   }
}
ASP.NET Web Service接口创建及调用方法教程 code 9527 博客

解决方案

Yes, you can do it using SoapExtensions. Here's a nice article that runs through the process.