Unable to call web service from web page

 I know this has probably been asked dozens of times before but as it's a fairly general, simple question I'm not sure what to search under.

I have a very simple web service that I want to make a callback to (from an AJAX.NET ScriptManager). At this stage all it returns is the out-of-the-box Hello World string. The web service, DataService.asmx, is as follows:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService()]
public class DataService : System.Web.Services.WebService
{
    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}

 

And here is the page which I'm calling the service from:

 

<script type="text/javascript">
<!--
    function useService()
    {
        ret = DataService.HelloWorld(OnComplete, OnTimeOut, OnError);
    }
   
    function OnComplete(retResult)
    {
        alert(retResult);
    }
   
    function OnTimeOut(retResult)
    {
        alert('Timeout');
    }
   
    function OnError(retResult)
    {
        alert('Error');
    }
// -->
</script>

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
    <Services>
        <asp:ServiceReference Path="DataService.asmx" />
    </Services>
</asp:ScriptManager>

<input id="Button1" type="button" value="button" onclick="useService()" />

I've verified that the service works as expected (by running it directly from the browser). But when I click on the button on the page above, nothing happens. I've run it in debug and the web service is never called. The web service exists at the same level as both the master page and the page I'm trying to call it from.

Can anyone explain to me why the web service isn't being called.

[I've based the code above on the www.asp.net video for AJAX.NET's predictive fetch demo (http://www.asp.net/learn/videos/view.aspx?tabid=63&id=100).]

0
awj
6/26/2007 7:37:17 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

2 Replies
798 Views

Similar Articles

[PageSpeed] 10

Suggestion:  If the web service is not called then you may want to post this on the AJAX forum since it may be an AJAX problem


If an answer has been provided to you question please mark it as an answer.
0
Mlogan
6/26/2007 9:04:28 PM

Hi,

Check out this article. http://www.devx.com/dotnet/Article/32508


Please mark the post as Answer if it has helped you or provided you with the solution.

Amit
0
AmitKhurana
6/28/2007 7:16:49 AM
Reply:

Similar Artilces:

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

Calling a Web Service from a Web Service
Hello,I was looking for some feedback on calling a web service from within a web service. I've heard that it's not good practice (or not possible). I have a scenario where I think it might make some sense.Within our infrastructure, we've created a web service that handles incoming updates on the statuses of all processes. This has proven to be a good thing since it allows applications to communicate across server to make status updates. It's also used by third party developers and applications to communicate with our infrastructure.Along these lines ... we are planning to create a new compon...

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: http://msdn.microsoft.com/webservices http://www.microsoft.com/downloads/details.aspx?familyid=06255a94-2635-4d29-a90c-28b282993a41&displaylang=en https://www.sys-con.com/dotnet/article.cfm?id=458 Hope this helps....

Can you call a web service from a web service?
I am trying to create a web service that itself consumes a 3rd party web service outside of our corporate firewall - so basically a web service consuming another web service.  I can consume this outside web service directly in an ASP.NET application without a problem.  But because the code is long and cumbersome, I wanted to provide our GUI developers an easy way to get all of the data they need from one source.  So I thought I could create an internal web service that would do a lot of things (query internal systems, for example) as well as consuming this external service.&nb...

Web service in .NET from Java Web Service
Hi there,I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.Here is the wsdl.<wsdl:definitions targetNamespace="http://www.dynix.com/schema/book">−<wsdl:types>−<schema targetNamespace="GetBookInfoByISBN">−<complexType name="BookInfoType">−<sequence><element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/><element maxOccurs=&quo...

difference of calling web services and calling web page
Dear all,  What is the difference of call a web services instead of calling a aspx page which is also programming can accept parameters and return results? Webservice -- Soap protocol Webapplication  -- HTTP protocol Webservices are of two Major types Xml & SOAP HttpWebServices Basic difference is in usage and implementation. We use a webservice inside a website. it is added as a reference or we can call it through HttpWebRequests and Response objects. Webpages are the components that have presentation and logic, while web services provide the service that we...

How i create web services & call web services?
Give me the solution of how i create webservices & call it and what is purpose of web services ?? PlsGuree  >how i create webservicesVery much the same as creating a new web site site - it is just a different project type. > & call it andAdd a web reference to an existing project to consume the web service.>what is purpose of web services ??To send and receive data.Don't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. &...

.NET web services Vs Java Web Services
Hello, does anyone know of a book or good source of information that compares .NET and Java Web Services? (I would like soemthing neutral if possible). I am thinking of approaching this subject for my dissertation? Many Thanks Rob Hi Rob, Last year I had to give a powepoint presentation on Web Services. I noticed some good books at barnes and noble that discussed the subject. These books were specific to Java and discussed Web Services in a very clear fashion. They gave some elementary examples that were easy to understand. I have not yet had the pleasure of creatin .NET Web Servi...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

Web Site Project: How to configure web service URL in web.config (web service defined in a referenced DLL)
I have a web site that references a business logic DLL project. In the business logic project, there is a web service defined in its app.config file something like this: <applicationSettings>  <MyNamespace.BLL.Properties.Settings>    <setting name="MyNamespace_BLL_MyServer_ServiceName" serializeAs="String">    <value>http://blah.blah.blah.asmx</value>  </setting>  </MyNamespace.BLL.Properties.Settings></applicationSettings> When the web site is published, the web ...

DynamicPopulateExtender: Web Service call failed: 12152, Web Service call failed: 12031
Hi, I'm using a DynamicPopulateExtender to take the value of a SELECT dropdown and pass it to an onpage web service (defined with <System.Web.Services.WebMethod()> _ '<System.Web.Script.Services.ScriptMethod()>) and as PUBLIC SHARED FUNCTION myfunction(contextKey as string) as string. The function returns the html for a listbox. Everything seems to fire properly on the client but when the web service is called by the Javascript function, I get Web Service call failed: 12152 or Web Service call failed: 12031 Any pointers would be appreciated.  Do...

Calling an asynch web service within an asynch web service.
I have read two different articles regarding optimizing thread pool utilization by calling asynchrounous web methods and then calling an asynchronous method within them. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service10012002.asp http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx The first article has an asynch web service method asynchronously calling another web service method. The second article has an asynch web service method spawning a new .NET thread and asynchronously calling it. I would like to use...

Web service or Web page?
One client want to communicate with our server. The data is simple. So I think that there are the following solutions to solve this problem. 1. the client use httpwebrequest to send data by get or post method. The server side is a web page. It can parse the request and retrieve data from query. After processing these data, the server send back a response objec to the client. This solution can be used whatever the client is a window application or a web application. The problem is that the server send the whole web page to the client. In order to solve this problem, I use in-line se...

Problem calling Web Service using the DynamicPopulate Extender
Hi, I'm quite new to ASP.Net AJAX so please forgive my ignorance.  I have downloaded and installed the RC1 version and am following through some of the tutorial videos.  I am having a problem with the Dynamic Populate Extender example.  I have created some asp controls with onclick events calling a javascript function.  From there I am attempting to use a dynamic populate extender control to call a web service - it's a function declared on that ASPX page as the tutorial explains in necessary and decorated with the System.Web.Services.WebMEthod AND System.Web.Script.Serv...

Web resources about - Unable to call web service from web page - asp.net.xml-web-services

United States Department of Health and Human Services - Wikipedia, the free encyclopedia
The United States Department of Health and Human Services ( HHS ) is a Cabinet department of the United States government with the goal of protecting ...

Melbourne Storm, St George-Illawarra Dragons continue Emergency Services Cup
Melbourne Storm will give 1000 tickets to fire fighters and other emergency services members for their opening home game against St George-Illawarra. ...

Netflix starts blocking VPNs, proxies, and other unblocking services
... VPNs. Last week, on January 14, Netflix said that it would begin cracking down on customers who use VPNs, proxies, or other "unblocking" services ...

Bluelock Certified with Advanced Designations to Provide Cisco Powered Cloud and Managed Services
Bluelock Certified with Advanced Designations to Provide Cisco Powered Cloud and Managed Services Business Wire (press release) INDIANAPOLIS(BUSINESS ...

Uber Expands On-Demand Food Delivery Service To 10 More Cities
... the world at large can now simply order their meals from their Uber app. The ride-hailing company expanded its UberEATS meal-delivery service ...

Digitimes Research: Amazon launches Alpine chips to support its entertainment services
... in January 2015, Amazon has recently launched its Alpine family chips for front-end network and multimedia applications. The Internet service ...

IBM buys Ustream to power its new video services division
... planning to nab video livestreaming company Ustream, the deal is official. The internet broadcast outfit will join IBM's new Cloud Video Services ...

IBM Buys Ustream, Launches Cloud Video Services Unit
With its acquisition of Ustream, a provider of cloud-based video streaming services, IBM announced the launch of a new cloud video services unit. ...

General Motors Embraces The Future With Car-Sharing Service Maven
Maven, the new umbrella brand for General Motors's car-sharing efforts, points to a future in which car ownership is no longer the norm. It's ...

Funeral Services Set for Slain Ohio Police Officer
Funeral services are set for an Ohio police officer authorities allege was killed by a man suspected of targeting an officer.

Resources last updated: 1/23/2016 12:26:13 AM