java调用.net的WS,参数无法读取到,该怎么处理
java调用.net的WS,参数无法读取到
如题,我把c#写的WS代码贴出来
[SoapRpcMethod(Action = "http://www.56rh.com/WS/getName", RequestNamespace = "http://www.56rh.com/WS/", ResponseNamespace = "http://www.56rh.com/WS/", Use = System.Web.Services.Description.SoapBindingUse.Literal)]
[WebMethod(Description = "")]
public string getName(string name)
{
writefile(name);
return "Hello" + name;
}
我写了这个简单的例子,writefile为读取参数写入本地txt,java端调用我WS始终返回hello.查看txt显示参数name为空。
有人遇到过这样的情况么
------解决方案--------------------
累不累啊?
你可以先写一个ashx,例如
如题,我把c#写的WS代码贴出来
[SoapRpcMethod(Action = "http://www.56rh.com/WS/getName", RequestNamespace = "http://www.56rh.com/WS/", ResponseNamespace = "http://www.56rh.com/WS/", Use = System.Web.Services.Description.SoapBindingUse.Literal)]
[WebMethod(Description = "")]
public string getName(string name)
{
writefile(name);
return "Hello" + name;
}
我写了这个简单的例子,writefile为读取参数写入本地txt,java端调用我WS始终返回hello.查看txt显示参数name为空。
有人遇到过这样的情况么
------解决方案--------------------
累不累啊?
你可以先写一个ashx,例如
- C# code
<%@ WebHandler Language="C#" Class="HelloJava" %> using System; using System.Web; public class HelloJava : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello " + context.Request.QueryString["name"]); } public bool IsReusable { get { return false; } } }
------解决方案--------------------
------解决方案--------------------
通过抓包工具可以看到java端在调用.NET WS时已经将值传送过去。
问题是否处在WS设置上?