How do you know which web method has returned when your OnComplete function gets called after multiple requests to a web service?


var prm;

function pageLoad() {

prm = Sys.WebForms.PageRequestManager.getInstance();

if (!prm.get_isInAsyncPostBack()) {

WebService.get_defaultFailedCallback(OnFailed);

WebService.set_defaultSucceededCallback(OnComplete);

WebMethod1();

Webmethod2();

}

}

function OnComplete (results) {

 // e.g. if (webmethodcalled == 'WebMethod1') { }

}

 How do you tell which method has returned the result? Is there an event handler for each individual method that can be used? 

Thanks

0
asp0
1/22/2008 2:22:42 PM
asp.net.client-side 24353 articles. 1 followers. Follow

2 Replies
1060 Views

Similar Articles

[PageSpeed] 52

I need to stop answering my own questions...

http://msdn.microsoft.com/msdnmag/issues/07/01/ExtremeASPNET/default.aspx

The method to call can be specified as an extra optional argument.

WebMethod1(arg1, WebMethod1OnComplete);

WebMethod2(arg1, WebMethod2OnComplete);

0
asp0
1/22/2008 2:51:35 PM

Then don't specify a default SucceededCallback and default FailedCallback.  In the following example, I specify different OnComplete callbacks, but the same OnError callback, but I could have just as easily had different error callbacks too: 

<script type="text/javascript">

    MyWebMethods.WebMethod1(WM1OnComplete, OnError);
    MyWebMethods.WebMethod2(WM2OnComplete, OnError);

    function WM1OnComplete(result) {
        // whatever...
    }

    function WM2OnComplete(result) {
        // whatever...
    }

    function OnError(error) {
        // whatever...
    }

</script>
 
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


My latest ASP.NET AJAX blog entries.
0
DisturbedBuddha
1/22/2008 2:51:50 PM
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...

system.Net.WebException: The request failed with HTTP status 405: Method Not Allowed. Error in Calling Web Service Function
Hello Friends, I am using a web service to get availability information. i have only following url http://webservices.micros.com/ows/5.1/Availability.wsdl I added Web References to the VS 2008 project , then i tried C# proxy class created from wsdl tool But when i am calling any function from code it gives following error system.Net.WebException: The request failed with HTTP status 405: Method Not Allowed. Please check the following page http://go-dev.com/clients/newyorkerhotelTest/reservations.aspx And click the Check Availability Button. Please tell me what...

differences between server side asynchronous Web methods and client side asynchronous Web methods
Hi,   can anyone expalin what are the differences between server side asynchronous Web methods  and client side asynchronous Web methods in ASP.Net 2.0 ?   any best articles on serverside asynchronous Web methods  ?   Thanks,  hi, check this url, Server-Side Asynchronous Methods for ASP.NET, http://www.codeproject.com/KB/cpp/asyncws.aspx   Calling the Server-Side method asynchronously from Client Script, http://www.c-sharpcorner.com/UploadFile/dipenlama22/Callbacks07182006093320AM/Callbacks.aspx...

asynchronous call of web service method from another web service
I am calling a web service method from within another web service.  Both are called asyncrhonously. Webservice 1 is invokde from a consumer app and its completed event is assigned an event handler, this works ok  The webservice being called is itself invoking another webservice and asynchronously calling another web method, again Ive assigned an event handler to its completed event, which works.  My problem is how do i expose the ouput (a dataset) of the second web method to the first web method ? Hi, Please have a look at this article: http://msdn2.microsoft.com/en-us/li...

REST Web Service : How to call a web service method by REST way ?
Hi buddy,Can anyone tell me that how do i call a method through a web service by a REST way.I have one local application (with C#.NET, ASP.NET 2.0, SQL Server 2005) and I want to call a Web Service method which is created on a remote machine. I have to call that method from my web application by using a REST (Representational State Transfer) way. I have a WSDL file.Please provide me technical details to make this happen.I want exact code to achieve this.Please please its urgent....Thanks in advance.Thanks,Mitesh.Please Mark this as an Answer if it resolves your problem. Which Version of .n...

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...

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...

Ajax calls web service. Web service returns string nodes and 1 node of binary data...How?
I've been all over the place looking for some helpful clues with ASP.Net 3.5 and handling binary data returned to a client.  Initially it was a standard PDF v1.3...at this point, I'd be happy to see that Ajax ASP.Net sending back an image or sound file embedded as binary data within the XML/SOAP data sent back to the user.  Below is one of several variations that I've tried.  Any suggestions? 1.  User clicks a button on the web page.  The button calls a JScript which calls the web service. 2.  The web service sends back an XML/SOAP respon...

It's all very fuzzy now...can make web request(?) but definately can't get web response from web service
Alas...trying to get a web service response from a web service that is part of the web site in Visual Studio.Net 3.5 appears to be impossible.  Infact, I've been ALL over the internet over the past couple of days looking at all types of fragmentory examples in all types of Microsoft languages to no avail. =========QUESTION:=========1.  How do I call a web service (the function to call is "WebService_BulkData") so that my aspx page will send it a SOAP request and print out the web service response data to the page?  The aspx page AND the web service are part of t...

How to call .net web service from Java web application?
Hi all,  I have a vb .net web service.How do i call .net web service from Java web application?What all resources I need?Can you please provide a sample application where a java application is invoking methods of .net web service? Thank you Hi, First I am not familiar with java language, but web services are universal operating system and language independent. It doesn't matter where the services is or in what language is written you just invoke it  and it gives you "replay".  Probably you must reffer to java consuming web services.   Regard...

Web Service OnComplete not getting called
After way too much pain, I do have my simple web service being invoked. I know that it's being invoked in a couple of ways: a) The debugger breaks in the .asmx.cs code; b) Fiddler shows a 200 return code and my return data as part of the HTTP response.However, my "OnComplete" method is not getting called. I know it's not getting called, as neither an alert() statement or a debugger statement get fired from the OnComplete method. Here's the script part of my page:<script type="text/javascript"><!--function OnLoadComplete(result){alert("Completed");  for (var i=0; i < result.l...

Web service method not getting called
I have written and tested a web service in .net and it works fine on the localhost when I consume it from my script but after publishing it on the remote server, calls to it encounter a 500 server error. I have looked at the IIS configuration and everything looks fine. Any suggestions? If I call the web service directly from the browser like http://d41750test/CWF/CWF.asmx I am presented with the list of public methods. I can select the methods and provide the parameters I'm prompted for and receive the expected result. However, when I call the remote web service ...

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...

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 resources about - How do you know which web method has returned when your OnComplete function gets called after multiple requests to a web service? - asp.net.client-side

Esmerelda Clovington (@essieclovington) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...


BeatPick: Music licensing for Film, Tv and Advertising use (license pre-cleared music)
License original and selected Indie Music for Movie, Web, Corporate, Games and DVD use. Quick, easy and online. Only the best music around.

format callback indentation bugs · Issue #49 · maxogden/standard-format · GitHub
standard-format - converts your code into Standard JavaScript Format

Easily Create Dynamic Grid Layout With FreeWall
If you are familiar with Windows 8 or Pinterest, you know of the dynamic grid layout. A dynamic grid is a layout where you can rearrange and ...

AJAX Hello World with Prototype
Welcome to Reality V2.0. A weblog talking about the Internet, the Web 2.0 revolution, and important trends in the industry.

Using the AJAX Interface
protected void Page_Load( object sender, EventArgs e) { AdmAuthentication admAuth = new AdmAuthentication( "ClientId" , "ClientSecret" ); AdmAccessToken ...

NBA Philippines
- Teams - EASTERN CONFERENCE Atlantic Boston Celtics Brooklyn Nets New York Knicks Philadelphia 76ers Toronto Raptors Central Chicago Bulls Cleveland ...

MusicBrainz Picard
Swiftly rename and organize all the music tracks on your PCespecially mislabeled ones.

Tag: ria
One of the big problems with Papervision as a 3D engine is that because it’s cross platform, not hardware accelerated, it really uses up a lot ...

Resources last updated: 12/12/2015 2:32:01 AM