Java調用.net的WebService時有參無參都可以成功:
[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]//若要允許使用 ASP.NET AJAX 從指令碼中調用此 Web 服務,請取消對下行的注釋。 [System.Web.Script.Services.ScriptService][SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)] public class Service : System.Web.Services.WebService {public Service(){ //如果使用設計的組件,請取消注釋以下行 //InitializeComponent(); }/// <summary>/// 對服務調用的基本測試(無參函數)/// </summary>/// <returns></returns> [WebMethod][SoapRpcMethod(Use = SoapBindingUse.Literal, RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/")]public string HelloWorld() {return "HelloWorld!"; }[WebMethod][SoapRpcMethod(Use = SoapBindingUse.Literal, RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/")]public string HelloArgs(string str, int n){return string.Format("HelloArgs! str:{0}, n:{1}", str, n);}
}