Calling webservices outside a domain with Javascript

The last few days i saw some threads about calling a webservice which is outside your domain with Javascript. Because of the restriction that is made for the path property of the servicereference <servicereference Path=”"> (same domain restrictions) it isn’t possible to make a reference to an webservice which is outside your domain. Well in MS Ajax Beta 2 version we could use bridge files to solve this problem. MS Ajax v1.0 doesn’t support bridge files anymore. So we must use another workaround.

The other workaround is using a second webservice (WebserviceA) which makes the call to the webservice (WebserviceB) outside your domain. This is very simple to build.

(WebserviceA)

WebserviceA should be configured in a way that it can accept calls from Javascript, take a look here to see how. This webservice must have a reference to WebserviceB which is outside your domain. You add a reference like we .NET developers are used to. (Add webreference)

(WebserviceB)

WebserviceB can be configured like a normal webservice and there you go!

Hope this helps you!

One Response to Calling webservices outside a domain with Javascript

  1. Geoff says:

    Obvious really once someone else thinks of it. Thanks, this helped me today.
    Geoff

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.