我用几个简单的方法创建了测试肥皂服务:
using System;
using System.IO;
using System.Web;
using System.Web.Services;
namespace CallbackServicePKB
{
[WebService(Description = "CallbackServicePKB", Namespace = "CallbackServicePKB")]
public class ReportCallback : WebService
{
[WebMethod(Description = "check if report is available for import")]
public Boolean isAvailable()
{
return true;
}
[WebMethod(Description = "import report")]
public String importReport()
{
var request = HttpContext.Current.Request;
string path = @"c:\temp\soap_request.txt";
if (!File.Exists(path)) {
string createText = "File created!" + Environment.NewLine;
File.WriteAllText(path, createText);
}
string appendText = "New request" + Environment.NewLine;
File.AppendAllText(path, appendText);
return request.Url.OriginalString;
}
}
}
我想要做的是将请求中的参数写入文件。
如何在方法内获取参数?
答案 0 :(得分:1)
尝试使用您请求的参数声明您的方法(名称应该相同)并获取方法内的值。
public Boolean importReport(int requestId, String reportURL, String signature){ }