[mashup-dev] Annotating JavaScript to make JavaScript Web services Deployment easy

Deepal Jayasinghe deepal at wso2.com
Thu Mar 1 22:26:11 PST 2007


It is very cool feature to have JS2WSDL support , and annotation will
help to support that. What you just need to do is populate the
AxisService correctly then at the run time you would get the right wsdl.

Thanks
Deepal

Sanjiva Weerawarana wrote:

> Outstanding! :) So we can use this to annotate Javascript to help
> generate WSDL also right?
>
> Cool!
>
> Sanjiva.
>
> Sameera Madushan Jayasoma wrote:
>
>> Hi all,
>> Deploying a JavaScript Web services can be as simple as just
>> deploying the JavaScript source file without  a services.xml. In this
>> instance we need a way to declare, what functions in the js source
>> file, should be exposed as Web methods. As an example, consider the
>> following js source.
>>
>> //@WebMethod
>> function getCurrencyCode(ipAddress){
>>    var code = getCountry(ipAddress);
>>    ....
>>    return currencyCode;
>> }
>>
>> function getCountry(ipAddress){
>>    .......
>>    return countryName;
>> }
>>
>> Only the function getCurrencyCode() is to be exposed as a WebMethod.
>>
>> I have developed a small patch for Rhino which enable parsing the
>> above special comments and mark the function as a WebMethod. Then it
>> is possible to modify the JSDeployer written by Thilina in the
>> following manner to identify WebMethods.
>>
>> Object[] ids = engine.getIds();
>> for (int i = 0; i < ids.length; i++) {
>>     String method = (String) ids[i];
>>     Object object = engine.get(method, engine);
>> -    if(object instanceof Function){
>> +    if(object instanceof BaseFunction &&
>> ((BaseFunction)object).isWebMethod()){
>>         AxisOperation axisOp = new InOutAxisOperation(new
>> QName(method));
>>         axisOp.setMessageReceiver(new JavaScriptReceiver());
>>         axisOp.setStyle(WSDLConstants.STYLE_DOC);
>>         axisService.addOperation(axisOp);
>>     }
>>
>> }
>>
>> This patch can be extended to support the required annotations
>> defined in JSR-181.
>> Sameera
>>
>> _______________________________________________
>> Mashup-dev mailing list
>> Mashup-dev at wso2.org
>> http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
>>
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"






More information about the Mashup-dev mailing list