O'Reilly logo

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications by Steven Cheng

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing a remote REST service in an AJAX client

As we have discussed in the Consuming a WCF service from an ASP.NET AJAX client recipe, ASP.NET AJAX script can consume a WCF REST service (with webScript behavior enabled) through the ScriptManager control. However, this kind of AJAX script client can only consume WCF services that are hosted in the same web application as the Web pages. Trying to access a remote WCF service through the ASP.NET AJAX script will not work. Don’t worry, we have found some alternative ways to work around this problem.

In this recipe, we will demonstrate a very simple way to call a remote WCF REST service in an ASP.NET web page via jQuery-based AJAX script.

How to do it...

Since XSS protection prevents AJAX scripts from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required