Skip to Main Content
Programming Atlas
book

Programming Atlas

by Christian Wenz
September 2006
Intermediate to advanced content levelIntermediate to advanced
408 pages
10h 38m
English
O'Reilly Media, Inc.
Content preview from Programming Atlas

Consuming External Web Services

As mentioned earlier, browser security forbids the XMLHttpRequest object from connecting to any domain but the one on which the current web page resides. Therefore, if you need data from a remote web service (one that is on a different server), there is only one solution: create a server proxy on your server and then call this proxy from your JavaScript code.

The good news: Atlas comes with built-in support for proxying such web services calls, namely a technology referred to as a web service bridge. In the following sections, we will create pages that get data from two of the most popular commercial web services: the Google search web service and the Amazon e-commerce web service. The techniques shown here can easily be adapted to any other SOAP web service.

The secret behind this lies in a new file extension that the Atlas installer prompted you to register with IIS (see Chapter 1): .asbx. Files with this extension can contain XML markup that provides information about a local (server-based) proxy class for a web service. The web page’s JavaScript code just connects with the .asbx file, which then takes care of communication with the remote service. Figure 10-5 shows this mechanism.

The client page calls the server bridge, which then calls the remote web service

Figure 10-5. The client page calls the server bridge, which then calls the remote web service

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Go Systems Programming

Go Systems Programming

Mihalis Tsoukalos

Publisher Resources

ISBN: 0596526725Supplemental ContentCatalog PageErrata