axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Fremantle" <pzf...@gmail.com>
Subject Re: Deploying a Javascript (E4X) service in Axis2
Date Fri, 28 Apr 2006 10:42:08 GMT
Oshani

Very cool!

Paul

On 4/28/06, Oshani Seneviratne <oshanis@gmail.com> wrote:
>
> Dear all,
>
> This is to introduce how you could write a service entirely in javascript
> and deploy it on Axis2. It's very simple and this is what you have to do:
>
> 1. Write the javascript service:
> This service should be implemented using E4X [1] , which extends the
> semantics of familiar Javascript operators to manipulate XML data. The input
> argument to the service function would be an xml and the output from the
> function should also be an xml.
>
> 2. Write the META-INF/services.xml:
> This follows the axis2 convention of deploying a service. However the
> messageReceiver in this case should be "
> org.sample.javascript.JavaScriptReceiver", and the ServiceClass parameter
> should include the javascript source file instead of the service class.
>
> 3. Put js.jar [2] into the "lib" folder.
>
> 4. Package the javascript source file, "META-INF", "lib" and the class
> files "org.sample.javascript.JavaScriptReceiver" and "
> org.sample.javascript.JavaScriptEngine" into an axis2 archive (aar) file.
>
> The JavaScriptReceiver processes the incoming message and extracts the
> following from the MessageContext :
> ---Javascript function name ( i.e. the operation the client requests)
> ---The arguments / payload to be sent to the javascript service
> ---The javascript source stream
> 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.
>
> I have included a patch of JavaScriptReceiver.java and
> JavaScriptEngine.java at http://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12332773
> . A working service archive (JavaScriptService.aar) and a Java client (
> JavaScriptClient.java) to test the service is also available from the same
> location.
> I would very much appreciate it if someone could review it and apply the
> patch at ../axis2/archive/java/scratch/ .
>
> Any comments and suggestions for improvements are highly appreciated.
>
> Thank you.
>
> Regards,
> Oshani Seneviratne.
>
> [1] http://www.ecma-international.org/publications/standards/Ecma-357.htm
>
> [2] "js.jar" is available for download at http://www.mozilla.org/rhino/download.html
> .
>
> Patch is available at http://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12332773
> .
>
>


--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

Mime
View raw message