Calling webservices outside a domain with Javascript
February 12, 2007 1 Comment
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!