.net写的WebService被Java调用
发布时间:2020-12-17 01:12:10 所属栏目:安全 来源:网络整理
导读:Java调用.net的WebService时有参无参都可以成功: [WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。 [System.We
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); } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |