关于在java环境下调用 .net的 webservice无法获取参数的问题,
在我的项目中遇到这种情况的解决方案是
![](/Images/OutliningIndicators/ContractedBlock.gif)
Code
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Services.Description;
/// <summary>
/// JAVAService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class JAVAService : System.Web.Services.WebService
{
public JAVAService()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
[SoapRpcMethod(Use = SoapBindingUse.Literal, RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/")]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod(Description="测试接口")]
[SoapRpcMethod(Use = SoapBindingUse.Literal, RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/")]
public string Test(string strTemp)
{
return "你输入的参数是:"+strTemp +" 当前时间是:"+System.DateTime.Now.ToString();
}
}
只要加上红色部分 那句代码就行了!
至于为什么,我也没搞清楚