You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

Mozilla WSDL Example

Doron Rosenberg (

With Mozilla 1.4beta, Gecko has WSDL (Web Service Description Language) capabilities that allows it to easily communicate with web services.  In this example, the Amazon web services will be queried for books matching the string the user entered.

Note about Security
Since this example needs to call another domain ( to, it breaks the cross-domain security model that Mozilla has.  There is a new model developed especially
for web services in Mozilla 1.4beta that allows a web service to grant the browser permission to call it.  However, since it is very new, it hasn't reached yet the public web services out there.  Therefore, as a workaround, you have to bypass it by setting the following user preference:

user_pref("signed.applets.codebase_principal_support", true);

This will make Mozilla prompt you to allow it to access

The example allows the user to search the Amazon web service for books matching a given keyword.  For example, typing in "Mozilla" will match books related to the infamous lizard.  To run the example, click here.

How it Works
First, we instantiate an "Amazon" object using their WSDL file.  This creates a proxy object in the browser for the Amazon web service which can then be scripted as if it where a local resource.  The WSDL file describes the interface, detailing which  methods can be called, which arguments to pass in and what the response will look like.  When a method is called on the proxy object, Mozilla generates a SOAP envelope based on the WSDL file and sends it to Amazon.  When Amazon responds, Mozilla is able to convert that SOAP response into a JavaScript object.  In this case, an array of "book" objects, where each book contains information such as the title, an array of the authors, the retail and amazon's price and more. 

The example then takes this information and displays it by adding it to the page's DOM - no new page has to be loaded.

Resources's Web Services Project Page
SOAP In Gecko
Amazon Web Services