Saturday, March 24, 2012

Call an external web service from AJAX

HI,

I have tried ServiceReference element in ajax but it allows me to use a webservice if its part of the same project only.

What if i ahve a seperate webservice project and i want to refere webmethod from that service?

How i can call a webmethod that is in service outside of my project?

THanks,

You write a wrapper WebService to call the external one. While there is a constraint on JavaScript calling external WebServices, there's nothing to stop your WebService calling external WebServices.

Write yourself a WebService which can be called from your JavaScript then have that WebService call the external one, passing the results back to your javascript

You'll need to use the WebRequest and WebResponse objects in your WebService, or maybe you can set up a proxy in the same way you'd reference a WebService in the normal way


Hi,

the following article might help:

http://dotnetslackers.com/columns/ajax/MashitUpwithASPNETAJAX.aspx

No comments:

Post a Comment