views:

1948

answers:

4

I need to connect to an asmx webservice using javascript. the webservice accepts and returns a soap response. im looking for an example bit of code of how i can connect to the webservice using javascript. it returns lat and long details which i'll then use to plot markers on a google map. i also have the issue of cross domain scripting...

should i provide and example of the soap response?

thanks.

A: 

There are some JavaScript SOAP client libraries out there:

Those libraries will allow you to easily make a SOAP Request and handle the results.

CMS
thanks, will give jquery a whirl, didnt even think to use it!!
Neil
A: 

I strongly suggest that you implement the SOAP client on your web domain. Let the JS call your server, which in turn calls the ASMX. The response of the web service should then be converted to a suitable JSON on your server before sending it down to the client.

This way, you get rid of your cross-domain problems, you don't load a SOAP client in the browser, you transmit less wordy data to the client, and you have the option of caching web service calls at your server to speed things up if you want to.

Rakesh Pai
A: 

ok, so i would just get my client to put the SOAP client file on their server, as i dont have access, and then i would connect to it using javascipt on the client side?

Neil
A: 

thanks to both of you.

Neil