One of the (current) key restrictions of the Webservice behavior is that the web service the behavior calls must reside on the same web server from which the HTML and the behavior itself were downloaded. You could not, for example, download an HTML page and behavior from www.yahoo.com and then use the behavior to directly call a web service that resides at www.microsoft.com.
If you need to call a web service that resides on a different server, you must create a web service that you can put on the same site as the HTML file and behavior, which will call the remote service on behalf of the behavior. In other words, you must create a web service that acts as a proxy.
In Chapter 2, you created the NestedCall web service, which provides the GetMSFT method, which itself uses a stock quote service from the XMethods website. The CallRemoteService.html file uses the NestCall web service, much like a proxy service, in order to retrieve and display the price of the Microsoft stock, as shown in Figure 3.9. Listing 3.8 implements the CallRemoteService.html file.
Listing 3.8 CallRemoteService.html
Figure 3.9: Using the Webservice behavior to interact with “local proxy” web service