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,例如
<%@ 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; } }}
[解决办法]