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!

Advertisements

2 Responses 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

  2. fuck me says:

    An impressive share! I have just forwarded this onto a friend who was conducting a little research on this.
    And he in fact bought me dinner due to the fact that I found it
    for him… lol. So let me reword this…. Thanks for the
    meal!! But yeah, thanks for spending the time to discuss this issue here on your web page.

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: