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,ResponseNamespace = "http://tempuri.org/")] public string HelloArgs(string str,int n) { return string.Format("HelloArgs! str:{0},n:{1}",str,n); }
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。