您可以从Web参考中调用Java服务来调用Web服务吗?

编程入门 行业动态 更新时间:2024-10-27 16:34:44
本文介绍了您可以从Web参考中调用Java服务来调用Web服务吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个网络参考,我试图从我的Java脚本代码中调用,但是我似乎无法获得操作结果或错误.可以使用Java脚本从Web引用调用Web服务.

I have a web reference I am trying to invoke from my java script code but I can''t seem to get a result or an error for the operation. Is is possible to invoke a web service from a web reference using java script.

<ScriptManager ID="RSM1" runat="server"> <services> <asp:ServiceReference Path="myhost/services/postings/pservice.asmx" /> </services> </ScriptManager>

上面是我在页面上注册Web服务的方式,下面是我的调用方法.和完整的方法.它永远不会进入完整方法或失败方法

above is how I am registering my web service with the page and below is my calling method. and complete method. It never gets to the complete or the fail method

function LoadPage() { alert("test we here in LoadPage "); PService._LoadPostingArchive(OnWSRequestCompleted, OnWSRequestFailed) } function OnWSRequestFailed(error) { alert("Stack Trace: " + error.get_stackTrace() + "\r\n" + "Error: " + error.get_message() + "\r\n" + "Status Code: " + error.get_statusCode() + "\r\n" + "Exception Type: " + error.get_exceptionType() + "\r\n" + "Timed Out: " + error.get_timedOut()); } function OnWSRequestCompleted(result) { alert("test we here "); var tableView = $find("<%= gvArchive.ClientID %>").get_masterTableView(); if (results != null) { alert("teste we in "); tableView.dataBind(); tableView.set_dataSource(result); $find("<%= RadAjaxLoadingPanel1.ClientID %>").hide("<%= gvArchive.ClientID %>"); } else { alert("test we out "); } }

推荐答案

find(<%= gvArchive.ClientID%>").get_masterTableView(); if(结果!= null){ alert(测试我们在"); tableView.dataBind(); tableView.set_dataSource(result); find("<%= gvArchive.ClientID %>").get_masterTableView(); if (results != null) { alert("teste we in "); tableView.dataBind(); tableView.set_dataSource(result);

find(<%= RadAjaxLoadingPanel1.ClientID%>").hide(<%= gvArchive.ClientID%>"); } 别的 { alert(测试我们"); } } find("<%= RadAjaxLoadingPanel1.ClientID %>").hide("<%= gvArchive.ClientID %>"); } else { alert("test we out "); } }

该服务在您的应用程序本地还是在远程服务器上运行?远程服务器会给您带来麻烦,但是本地Web服务应该可以.首先,您应该使用服务器端路径,该路径应类似于以下内容: Is the service local to your application or is it running on a remote server? The remote server will give you trouble, but a local web service should be fine. First of all, you should use a server-side path, which would look something like this: <asp:ServiceReference Path="~/services/postings/pservice.asmx" />

另外,通常将通过在Web服务名称之前包含名称空间来调用服务,例如:

Also, you will typically call your service by including the namespace before the web service name, such as this:

// Namespace.WebServiceName.WebMethodName() SomeNamespace.PService._LoadPostingArchive(OnWSRequestCompleted, OnWSRequestFailed);

我还注意到您在行尾没有分号.而且,如果您的网络方法具有任何参数,那么将会明显改变调用.

I also noticed you didn''t have a semicolon at the end of your line. And if your web method has any parameters, that will change the call a bit (obviously).

更多推荐

您可以从Web参考中调用Java服务来调用Web服务吗?

本文发布于:2023-10-07 10:51:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469195.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:您可以   Web   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!