You are currently viewing a snapshot of www.mozilla.org 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 www.mozilla.org, please file a bug.



Mozilla WSDL Example - Using Translation Web Services Widget

Marcio Galli (mgalli@mgalli.com)

This page demonstrates the use of Web Services technology in Mozilla. The demonstration works with Mozilla 1.4beta and newer versions. It uses the Gecko's WSDL capabilities and shows a JavaScript-based application that connects with Babelfish Web Services at xmethods.com.

thanks to Babelfish!, thanks to Xmethods.net!

The demo is basically a widget that offers translation funcionality. The Translation widget is entirely written in JavaScript and can be tied to the browser's interface to translate contents of generic web pages.

Notes about cross-domain and security

The JavaScript code will establish calls to xmethods.com web site, specifically the Babelfish translation Web Service, without showing security alert box. This is possible because of the New Security Model in Mozilla that allows xmethods.com to grant access ( via an xml file ) to its services from any domain.

Without the cross-domain restrictions, this JavaScript application can be placed in any web page, regardless the domain, and will be able to request the remote translation services via Babelfish. There are two ways you can test this demonstration:

Inline Sample: Testing the Translation Service

English>portuguese | English>French | English>German

Results:

Babelfish Translator Widget

Mozilla allows you to drag links to the personal bar. If the link is a "javascript:" statement and is clicked from the personal toolbar, it will be executed in the scope of the currently displayed web page. Because of this, the translation widget will work on top of other sites. You can simply drag one of the following links to your personal toolbar and start using this widget.

This demonstration shows that Web Services interfaces can be plugged on top of existing web pages to extend its funcionality. With the new security model in Mozilla, a web page can include scripts to connect with multiple Web Services providing a combination of services all together.