Submitted on May 1, 2006 - 20:59.
Implementation in a Nut-shell
Are you wondering how all this could happen? Then here's what you may want to know. It's highly recommended that you read Axis2 User's Guide before continuing with this tutorial.
To deploy a Javascript (E4X) [1] service, first you need to have JavaScriptReceiver, JavaScriptEngine classes and js.jar [2] library in your classpath. The JavaScriptReceiver processes the incoming message and extracts the following from the MessageContext:
It then calls the JavaScriptEngine which uses the Mozilla Rhino API to process the javascript. The JavaScriptEngine returns an xml string object to the JavaScriptReceiver and the latter encodes the result and sends the outgoing MessageContext.
Writing & Deploying a Javascript ServiceSo, now if you are interested in getting in to the action by writing and deploying a Javascript service in Axis2, here's what you have to do:
If you prefer to skip the exercises, and go to the answers directly, a working example is available at [3]. Simply drop the JavaScriptService.aar into your webapps/axis2/WEB-INF/services and run the JavaScriptClient!
Appendix
Applies To:
Apache Axis2/Java versions before 1.0