Tuesday, December 30, 2008

17 years of Dominance at Home comes to an End

The last time Australia lost a test series at home was way back in 1992/1993 when Richie Richardson's West Indies team beat Alan Border's men. Even that was a very closely fought series, with the West Indies taking the series by winning the last test very convincingly. Contrary this time around Gream Smith's men have been very convincing in taking the series. Australia sure had there moments but they did not have the fire power to deliver that knock out punch. In Perth, Ponting had the Proteas chasing 414 and could not defend it and in this game at the MCG he had them at 7/188 but could not get the tail as they motored their selves along to 459.

What Australia lacks badly is the strike bowlers that they used to have. Australia without Shane Warne and Glen McGrath is not too intimidating. The struggling form of key Australian batsman haven't helped them either, both Mathew Hayden and Micheal Clarke have been out of sorts.

Friday, December 26, 2008

Carbon based beta releases are out!

We've released the betas of four WSO2 products based on the revolutionary Carbon platform. All betas are now available for download from the WSO2 Oxygen Tank. We hope to release the final versions of these products mid January.

Wishing all a Mery Christmas

He had no Servants, yet they called him Master
No degrees, yet they called him Teacher
No medicine, yet they called him Healer
No army, yet the kings feared Him
He won no military battles, yet he conquered the whole world
He committed no crime, yet they crucified Him
He was buried in a tomb, yet he lives Today
Do you not feel honored to serve such a Man?
Have a fantastic and God-filled Christmas!

Tuesday, December 23, 2008

WSO2 Carbon - The Middleware à la carte

WSO2 Carbon is the base platform for all WSO2 Java products.

Built on OSGi, Carbon encapsulates major SOA functionality such as data services, business process management, ESB routing/transformation, rules, security, throttling, caching, logging and monitoring.

The Carbon Story
View SlideShare presentation or Upload your own.

Sunday, November 23, 2008

A Gripping Story of a Brave 11 Year Old

I heard this story on CNN this evening and I think its worth sharing. Its about a brave 11 year old by the name of Brenden foster who's life was cut short by leukemia. Sadly Brenden passed away a few days ago but I'm sure his legend will live on. He shows tremendous courage when he says "I should be gone in a week or so"... Its a truly touching story and I'm sure it will touch your lives too

WSO2 WSAS 3.0-alpha2 is now Available

WSO2 WSAS 3.0-alpha2 is now available for download. This version of WSO2 WSAS is based on revolutionary the WSO2 Carbon framework. Do try it out and give us your early feedback.

The process of Carbonizing the Mashup Server will start soon... Stay tuned for more news on the revolutionary Carbon framework from WSO2.

It's been a few busy weeks

Well I've been very quite this month. That has been due to several reasons. To start off with it was Apchecon 2008 (I'm still to write about the fabulous experience it Apachecon) and then it was the WSO2 WSAS releases. We released alpha1 last week and followed it up by releasing alpha2 this week.

I've also been caught up with some personal work where I've been doing some research and choosing universities to apply for Grad school for next fall... More on that later...

Wednesday, November 12, 2008

Back Home after a Great week at ApacheCon

I'm back home after a great week at ApacheCon in New Orleans. It was a fun-packed week with some really good sessions, excellent keynotes and of course really late nights :). Trying to get all the mail out of the way, its amazing how much you fall behind on just because of a week. I plan to post some writings on ApacheCon 2008 and the great times at New Orleans in the coming days. Stay tuned... (There is so much to write about, cant imagine where I should start ;)).

Thursday, November 6, 2008

Getting to ApacheCon 2008

I arrived in New Orleans a couple of days ago in order to attend ApacheCon 2008. My route to New Orleans was not that different from the one I took to Phoenix a couple of months back. The route was Colombo - > Singapore -> Narita - > Dallas -> New Orleans, with a total travel time of around 37 hours.

What was most interesting about the trip was that I was on a A380 from Singapore to Narita.

This was my first time on this monster and it was a nice experience. One thing that I did notice was tat it had more leg space than the other aircrafts. Also I love taking Singapore Airlines because of its entertainment system. There audio entertainment includes the UK top 10 charts from the 50s to date. I'm a huge fan of 70's and 80's music. I could listen to it all day and still want more... One of my most loved tracks is "Long Haired Lover from Liverpool" by Lt Jimmy Osmond.

Wednesday, November 5, 2008

ApacheCon 2008 Live video Streaming

Can't make ApacheCon this week in New Orleans? You can still watch all
the keynotes, Apache 101 sessions, and system administration track in
live video streams.

Keynotes and the Apache 101 lunchtime sessions are free; the full
sysadmin track, including httpd performance, security, and server stack
administration talks are available for a fee.

Keynotes include:
  • David Recordon, Six Apart (Wednesday 09:30) - "Learning from Apache to create Open Specifications"
  • Shahani Markus Weerawarana, Ph.D. (Thursday 11:30) - "Standing on the Shoulders of Giants"
  • Sam Ramji, Microsoft (Friday 11:30) - "struct.new("future", :open, :microsoft)"
Note : New Orleans is CST or UTC/GMT -6 hours.

Tuesday, November 4, 2008

Helping Enterprises Adopt Web Services in their SOA Architecture - BOF @ ApacheCon

I will be leading a Birds of Feather (BOF ) session titled "Helping Enterprises Adopt Web Services in their SOA Architecture" at ApacheCon 2008. This will be held in on Thursday, November 6 from 8:30 p.m to 9:30 p.m. Hope to see you there...

Thursday, October 30, 2008

WSO2 Mashup Server ScreenCast #3 - Service Composition

The third of Jonathan's screen cast on the Mashup Server is now out. This edition focuses on Service Composition using the WSO2 Mashup Server. It shows how easy it is to compose services as well as demonstrates the use of E4X constructs when writing mashups.

The first edition was a helloworld followed by how the mashup server could be used to do web scraping. You could have a look at the high-res version on the WSO2 Oxygentank at,
ScreenCast - Hello World
ScreenCast - Scraping
ScreenCast - Service Composition

Tuesday, October 28, 2008

Speaking at IITC 2008 - Server-Side Mashups for enterprise SOA

I will be conducting a half-day tutorial titled "Server-Side Mashups for enterprise SOA" at the 9th International Information Technology Conference (IITC 2008) on the 30th at the University of Colombo School of Computing. This will be a beginner level tutorial where I will talk of how the WSO2 Mashup Server can be used as an enterprise integration tool.

Monday, October 27, 2008

WSO2 Mashup Server Screencast #2 - How to Scrape a Web Page

In the previous screencast Jonathan explained how you could get started with the Mashup Server with a simple Hello World Mashup. Now the second in this series of Screencast is out.

In this screencast Jonathan explains how you could scrape a web page and make that information available to tour mashup. There is a whole load of information available on the web that is not accessible via an API and screen scraping can be used to get that information into your mashups.

You could view the Hi-Resolution version of this if you have good bandwidth.

Wednesday, October 22, 2008

Is Identity a Problem in your SOA? How about Identity as a Service

SOA promises unlimited agility and organizational flexibility with a new layer of services breaking out all existing application silos. As many businesses move ahead with SOA, identity management needs to be made available as a service in the architecture in a consistent and reusable way across all applications.

Prabath Siriwardena who leads the WSO2 Identity Solution team talks about how Identity can be thought of as a Service.

Tuesday, October 21, 2008

Book on RESTfull Web Services with PHP by Samisa

Samisa Abeysinghe's book "RESTful PHP Web Services" is now available for Purchase. Learn the basic architectural concepts and step through examples of consuming and creating RESTful web services in PHP.

What you will learn from this book:
  • Basic concepts of REST architecture
  • Consuming public REST-style services from your PHP applications
  • Consuming RESTful web services, such as those from leading APIs such as Flickr, and Yahoo Web Search
  • Making your own PHP applications accessible to other applications through a RESTful API
  • REST support in the popular Zend framework
  • Debugging RESTful services and clients
  • A case study of designing a RESTful PHP service from the ground up, and designing clients to consume the service
The book explains the basic concepts associated with the REST architectural style, but the emphasis is on creating PHP code for consuming and creating RESTful services in PHP. There is plenty of example PHP code to illustrate the concepts, with careful explanations of how the code works.
Who this book is written for:
This book targets PHP developers who want to build or make use of RESTful web services, or explore the options available to them in PHP. You will need to know the basics of PHP development, but no knowledge of REST is assumed, nor any knowledge of creating web services generally.
The book also contains a dedicated appendix chapter on using WSO2 WSF/PHP.

Sleeping on a Problem Provides Better Solutions

How true this is. I'm sure even you would have experienced this at some time or another.

"Sleep seems to nail down the information we have and reorganize the way it is stored in the brain," Prof Stickgold added. Which perhaps explains why sleeping on a problem often provides the best solution.

Read the full story here

WSO2 Mashup Server - Quick Start Guide

Channa has composed a nice little Quick Start Guide for the Mashup Server. It shows how you could get started by installing it and provisioning it and the later section cover how you could get data from a external web page using the scraper tool, how you could access a external web service using a generated stub and how you could read in a feed using the FeedReader.

Its a nice little pack that gets you started off pretty quick.

Will India's victory over Australia mark the end for Anil Kumble

Earlier today India completed a crushing victory against Australia in the second Test. India dominated this test match from day 1 and did not let the Aussies have a sniff. Notably Anil Kumble (India's Test captain) did not take the field in the second test due to injury and it was Mahendra Singh Dhoni who led India in his place.

Kumble's replacement in this test was Amit Mishra who infact made his debut in this test. The young mans performance was outstanding and he was a key reason for Australia's first innings failure. In contrast the man he replaced went wicketless in the first Test, and the media was calling for his retirement.

In my view Mishra's success in the second test plus Kumble's failure in the first could mean curtains for the international career of Kumble. Let me make no mistake Kumble had his times and in fact he is India's most successful spinner. with a test best of 10/74 Kumble has taken over 600 test sticks. But every good thing has got to come to an end and I feel that Kumbles good times are drawing to a end.

It will be interesting to see how Kumble will react to the media in the dawn of India's victory. I'm sure the media have plenty to say tomorrow...

Monday, October 20, 2008

India and Sri Lankas War agaisnt LTTE

Sanjiva has written an excellent blog asking India to stay away from interfering with Sri Lankas war against the LTTE.

Let me add a bit more to what Sanjiva had to say. If the politicians in Tamil Nadu are so worried about the innocent Tamils that are been trapped by the LTTE, why don't they pressurize the LTTE asking them to let go of the innocent civilians? The truth of the matter is that the LTTE is holding civilians in the north as a battle shield. What that would do is just delay the inevitable rather than stop it from happening.

Why is the so called INTERNATIONAL COMMUNITY keeping there eyes shut on this? Why don't they come forward and pressurize the LTTE to let go of innocent Tamil civilians? Are they just worried about the LTTE and not the innocent Tamils?

Some thoughts to ponder about....

Thursday, October 16, 2008

WSO2 Mashup Server Screencast - Getting started with a HelloWorld

The WSO2 Mashup Server is a platform for hosting mashups written in JavaScript with the E4X extension. These mashups can consume data from various sources such as feeds, HTML pages, external Web services, databases (via Data Services), Excel files (via Data Services) etc. These newly created mashups are then exposed as Web services in return.

In this Screencast, Jonathan Marsh, Director of Mashup Technologies for WSO2, demonstrates how to create a simple hello-world Web service using only the WSO2 Mashup Server and Notepad. A simple Javascript function is deployed as a Web service, WSDL and other metadata is automatically generated, and then the service is tested using the Mashup Servers try-it page. The service also shows how to quickly construct XML using the E4X Javascript extensions, and how to apply simple annotations documenting the operations and declaring parameter types.

Wednesday, October 15, 2008

Apache Synapse/WSO2 ESB calling a REST Endpoint

One of the features of Apache Synapse and the WSO2 ESB (Which is Apache Synapse + Monitoring + Management + WSO2 Registry Integration) is that it can change message formats.

There was a question on the ESB-USER mailing list recently asking how you could receive a SOAP message and send out a REST message (HTTP POST serialized as application/x-www-form-urlencoded) to another service. In order to do this you simply need to set two properties on the message. The HTTP_Method to be used and the messageType to be used. The following is a complete synapse.xml

<syn:definitions xmlns:syn="http://ws.apache.org/ns/synapse">

<syn:registry provider="org.wso2.esb.registry.ESBRegistry">

<syn:parameter name="root">file:registry/</syn:parameter>


<syn:proxy name="RESTProxy" startOnLoad="true">


<syn:endpoint name="RESTEndpoint">

<syn:address uri="http://localhost:7763/services/keith/test/foo"/>



<syn:property name="messageType" value="application/x-www-form-urlencoded" scope="axis2"/>

<syn:property name="HTTP_METHOD" value="post" scope="axis2"/>




<syn:sequence name="main">



<syn:sequence name="fault">




Here is the request sent into the ESB:

POST /soap/RESTProxy/mediate HTTP/1.1

Content-Type: application/soap+xml; charset=UTF-8; action="urn:anonOutInOp"

User-Agent: WSO2 Mashup Server - Version 1.5.1


Content-Length: 191

<?xml version='1.0' encoding='UTF-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">







Here is its response (or Request sent out to the REST service):

POST http://localhost:7763/services/keith/test/foo HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8;action="urn:anonOutInOp";
Transfer-Encoding: chunked
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO


Tuesday, October 14, 2008

How to Embed Axis2 into a Existing Web Application

This article by Deepal explains how you could embed Axis2 into a Existing Web Application. Its pretty straight forward and simple. Its a good resource for anyone who is trying to expose web services out of an existing web app.

How to Create a Mock Web Service using the WSO2 ESB

One of the key features of the WSO2 ESB (Enterprise Service Bus) are Proxy Services. This post explains how you could use the proxy services feature in the WSO2 ESB to create Mock Services. These services could offer a REST interface as well as a SOAP interface.

Customer uses WSO2 products to Increase Productivity

This article shows how Concur used the WSO2 Enterprise Service Bus (WSO2 ESB) and the WSO2 Web Services Application Server (WSO2 WSAS) to increase there productivity. It also states that the solution was build in a mere 3 hours whereas it took 3 weeks to build it with pure Java. The following is a quote from the article,

"In the initial deployment, the WSO2 data services technology was able to access the database and convert data into a SOAP message in "literally two minutes," according to Svee. During a training session with WSO2, the Concur team used the "WSO2 ESB to replicate a data synchronization system in three hours that the group had previously taken three weeks to build in Java.""

Wednesday, October 8, 2008

Apache Axis2 Tips and Tricks

Recently I've been blogging extensively on some tips and tricks related to Apache Axis2. Here's a summary of them,

Axis2 - Setting the HTTP Method when sending request

Apache Axis2 supports sending (and receiving) requests over GET, POST, PUT and DELETE. This can be done by setting the "Constants.Configuration.HTTP_METHOD" property on the options object. If the HTTP Method is not set explicitly then it defaults to POST.

Most often that not when changing the HTTP Method you may want to change the serialization format as well. This can be done by setting the "Constants.Configuration.MESSAGE_TYPE" property on the options object (You can change the Serialization format even without changing the HTTP Method. For e.g Send a POX message via POST).

The following code Snippet shows how to send a message as "application/x-www-form-urlencoded" over GET.


Tuesday, October 7, 2008

Axis2 - Adding custom SOAP Headers to a request using ServiceClient

The Axis2 ServiceClient API provides three main ways of adding SOAP Headers to a request. Lets take a look at how this could be done,

  • Add a simple header which contains a String to the request

serviceClient.addStringHeader(new QName("http://wso2.org", "ThirdHeader"), "This is a sample Header");

This is the simplest method of adding a header. But this method restricts you to simple String headers.

  • Creating a header as a OMElement and adding it to the request

OMElement firstHeader = AXIOMUtil.stringToOM(
"This is a sample Header");

Users are expected to create the complete header themselves using Axiom's OMElement APIs.

  • Creating a header as a SOAPHeaderBlock and adding it to the request

OMNamespace omNamespace =
OMAbstractFactory.getOMFactory().createOMNamespace("http://wso2.com", "ws");
SOAPHeaderBlock secondHeader = OMAbstractFactory.getSOAP12Factory().createSOAPHeaderBlock("SecondHeader", omNamespace);
secondHeader.addChild(AXIOMUtil.stringToOM("This is a sample Header"));

Users are expected to create the header using Axiom's SOAP APIs. Users could use the API to set various options on the header such as the MustUnderstand Attribute.

Monday, October 6, 2008

Axiom - How to create a OMElement from a String

If someone is using Axis2's ServiceClient to send a request to a service they will have to deal with OMElements. That is because ServiceClient accepts the payload as a OMElement. Using Axiom API's to create this OMElement could be time consuming and may take several lines of code. Alternatively users could create this OMElement from a String as follows,

OMElement payload = AXIOMUtil.stringToOM("Hi! This is a sample Request.");

This utility method that comes with Axiom takes in a String as the argument and returns an OMElement.

Axis2 - Setting custom HTTP Headers on a response

There may be instances where users would want to add a custom HTTP header to the response message in Apache Axis2. The following shows how this could be achieved,

MessageContext responseMessageContext =
List headers = new ArrayList();
headers.add(new Header(HTTPConstants.HEADER_CONTENT_ENCODING, "identity"));
responseMessageContext.setProperty(HTTPConstants.HTTP_HEADERS, headers);

This method could be used to add multiple headers to the response message. This also should how a service could get hold of the response message context.

Sunday, October 5, 2008

Panoramas of Beautiful Sigiriya

Sigiriya (which means Lions Rock) which is a ancient rock fortress built by King Kasyapa (477 – 495 AD) is located in the central part of Sri Lanka. Some people even call it the Eigth Wonder of the World, its that amazing. If you are traveling to Sri Lanka its a place that you must visit.

Ruwan Janapriya (A colleague of mine at WSO2) who is a great photographer has created some stunning Panoramas of of Sigiriya. There are several of them taken at various locations, some cover the beautiful paintings (frescos) of Sigiriya as well.

One of Ruwan Janapriyas Panoramas has been selected for the World Wide Panorama event 2008. Thats how good he is in Panography.

Friday, October 3, 2008

How to run Axis2 behind a proxy and Bypass the Proxy for some Domains

I'm sure some of you might already know how to set proxy details in Axis2. Even nandana had blogged about it some time ago. For those who are not familiar with it here is how you could do it. You need to add the following parameter into your clients axis2.xml,

<parameter name="Proxy">








There may be instances where you do not want some request to go through the proxy. For e.g lets imaging you do not want to go through the proxy on a localhost call or when you are calling foo.com. Is it possible to do this? Of course and you could do it by adding the following system property "http.nonProxyHosts",


The http.nonProxyHosts can be set to specify the hosts which should be connected to directly (not through the proxy server). The value of the http.nonProxyHosts property can be a list of hosts, each separated by | (the pipe character). It can also take a regular expression for matches for example: *.sfbay.sun.com would match any fully qualified hostname in the sfbay domain.

For more information you could refer http://java.sun.com/features/2002/11/hilevel_network.html.

Thursday, October 2, 2008

Axis2 - Calling a Service which is Protected by HTTP Basic Authentication

If you need to call a service which is protected using HTTP Basic Authentication with Apache Axis2, then you could do so by setting the following property on the options object.

HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);

If you are using a generated stub you could get hold of the options object as,


Axis2 wsdl2java - Generate Better Code with -uw

This is a question asked regularly on the axis-user list. "Code generated by the wsdl2java tool is hard to use. Is there any better way that I can generate code?".

The answer to this is that you could actually use wsdl2java to generate better code. Lets take an example scenario. For this I will be using a Service that I have deployed on Mooshup.com. This simple service has a operation called demo which accepts three parameters (firstParam, secondParam and thirdParam). I will be using the wsdl of this service for explanation. Lets first try to use wsdl2java on this wsdl and see what happens and how -uw can help.

If i was to generate a stub for this using the following command,

sh wsdl2java.sh -uri http://mooshup.com/services/keith/DemoService?wsdl -o /home/keith/projects/demo

I would have to use this stub as follows,

DemoServiceStub stub = new DemoServiceStub();
DemoServiceStub.Demo demo = new DemoServiceStub.Demo();
DemoServiceStub.DemoType demoType = new DemoServiceStub.DemoType();

Now this does not look too elegant, but if I were to generate code using the -uw option with the following command,

sh wsdl2java.sh -uri http://mooshup.com/services/keith/DemoService?wsdl -o /home/keith/projects/demo -uw

I would be able to use the stub as,

DemoServiceStub stub = new DemoServiceStub();
stub.demo("firstParam", 20.0, true);

Now what is more elegant and easier? Its a easy answer.

The secret to this lies in the schema. You wont be able to generate easy to use stubs such as this all the time. What gets unwrapped (when -uw is used) is the sequence within the complex type. In our case the schema was as follows,

<xs:complexType name="demoType">


<xs:element name="firstParam" type="xs:string" />

<xs:element name="secondParam" type="xs:double" />

<xs:element name="thirdParam" type="xs:boolean" />



<xs:element name="demo" type="ws:demoType" />

So the bottom line is use the -uw option when generating code with wsdl2java, this would generate code that is easy to use. (This should have been the default in wsdl2java ;))

Most users are not aware of the set of options that wsdl2java offer (Will cover that in another post).

Tuesday, September 30, 2008

Rendering a html file which is in svn as text/html

I'm sure people have come across this issue before. The solution for it is simple though.

If you were to browse to a html file in svn it would be rendered as text/plain in the browser, but if you needed it to be rendered as text/html you need to do the following.
svn propset svn:mime-type text/html
You could use the above command to set any mime-type on a file thats in svn.

Monday, September 29, 2008

Apache Axis2 Changing the Content-type of the Response

There are a couple of mechanisms that can be used to change the content-type of the response in Apache Axis2. They are,
  • Using HTTP Content Negotiation. Please refer HTTP Content Negotiation with Apache Axis2 for details.
  • Changing the content-type of the response explicitly by setting it to the response message context as follows,
      MessageContext messageContext = MessageContext.getCurrentMessageContext();
OperationContext operationContext = messageContext.getOperationContext();
MessageContext outMessageContext = operationContext.getMessageContext(
// responseFormat is the content type of the outgoing message
outMessageContext.setProperty(Constants.Configuration.MESSAGE_TYPE, responseFormat);

Sunday, September 28, 2008

Fernando Alonso wins Inaugural Singapore Grand Prix

Fernando Alonso won Inaugural Singapore Grand Prix a few moments ago. In the process he became the first man to win a night race. Singapore was the latest circuit to hold a Grand Pix and it was the first time that a race was held in the night. I'm not a Fomula One (like Channa is) fan but I did watch this race cause it was one of a kind. The race track was lit up by around 1500 lights powered by 24 generators with 110 KM of cable connecting them together. It was also said that the race track is lit so that no two adjacent lights could go off. Pretty impressive and on top of that (Literally over the race track) a grand stand that could hold 38,000 spectators.

It was a bad race for Kimi Raikkonen cause he crashed out with just four laps to go. He was in fourth place at the moment and was in position to pick up championship points.

Whats more Massa of the Ferrari team pulled out of the pit stop (It wasn't his fault because the light was green when he pulled off) with his fuel horse still connected. Not a good race for a few of the top guns.

Training on Apache Synapse & WSO2 ESB

Last week I had a great opportunity to attend a two day training on Apache Synapse and the WSO2 ESB (Enterprise Service Bus). This was an internal training conducted by Asankha. The first day of the training focused on what the WSO2 ESB is and how users would use it. He also took us through all the in built mediators of the ESB. The second day of the training focused on how the ESB Works. For me this was the most interesting part of the training.

Transports are a major part of an ESB. Asankha took us into detail of each transport, the most interesting was the JMS transport and the NHTTP Transport (Non Blocking HTTP Transport). I had played around with the JMS Transport in the mashup server. I even wrote an article on how the JMS Transport can b used in the mashup server. Knowing how to use something is different from knowing how it works.

Next in line was the most anticipated NHTTP Transport. This was the major component of the ESB and all its great performance was due to it. It was s pleasure to get to know how it works.

Prior to this i had used the WSO2 ESB on a customer project and getting to know how it works was really intriguing.

Friday, September 26, 2008

RESTful Web Services with Apache Axis2

RESTful Web Services with Apache Axis2 is powered by the WSDL 2.0 HTTPBinding, hence as of now (1.4.1 release of Axis2) users need to deploy there services using WSDL 2.0 to write truly RESTfull services in Axis2. I agree that there aren't too many people who are familiar with WSDL 2.0. Therefore I put together an article that helps you through the process of taking your Java code, generating a WSDL 2.0 from it and hand editing it to suit your needs. The article "RESTful Web Services with Apache Axis2" is now available on the WSO2 oxygen tank.

I plan on making it simpler to author RESTfull services in Axis2 in future.

Axis2 & Rampart - Access Username used for Authentication in a Web Service

Nandana in his blog post has explained how you could do this (Axis2 & Rampart - Access Username used for Authentication in a Web Service) with the latest Rampart code. But if you are using Rampart 1.4 that method will not work. Those users can use the following method,

MessageContext msgCtx = MessageContext.getCurrentMessageContext();

Vector results = (Vector) msgCtx

if (results != null) {

WSHandlerResult result = (WSHandlerResult) results.get(0);
WSSecurityEngineResult wsSecurityEngineResult =
(WSSecurityEngineResult) result.getResults().get(1);
String username =
((Principal) wsSecurityEngineResult.get(WSSecurityEngineResult.TAG_PRINCIPAL))

Thursday, September 25, 2008

Enabling JSON in WSO2 WSAS

In order to enable JSON support in WSO2 WSAS you will need to follow the following steps.
  1. Drop the axis2-json-1.4.1.jar (The version may change according to the WSAS version in use) in to the WSAS lib directory. You could download axis2-json-1.4.1.jar here.
  2. Drop the jettison-1.0.1.jar in to the WSAS lib directory. You could get it from here.
  3. Configure the axis2.xml in WSAS which can be found in the conf directory as described in "Enabling JSON in Apache Axis2".

Enabling JSON in Apache Axis2

Apache Axis2 can handle several message formats. JSON is just one of them. Axis2 supports two notations of JSON, they are known as mapped and Badgerfish. Namespaces are not handled in the mapped notation while the Badgerfish notations supports it.

The default Axis2 installation has all the binaries needed to process JSON messages but you need to enable it in order to use JSON. This can be done by adding the following sections to your axis2.xml.

Add the following section to the messageFormatters section in the axis2.xml,

<messageFormatter contentType="application/json"


<messageFormatter contentType="application/json/badgerfish"


<messageFormatter contentType="text/javascript"


And the following to the messageBuilders section of the axis2.xml

<messageBuilder contentType="application/json"


<messageBuilder contentType="application/json/badgerfish"


<messageBuilder contentType="text/javascript"


Now you are all set to invoke services as well as respond using JSON. You would notice that the notation of JSON used depends on the content-type of the message.

Deploying WSO2 Registry on JBoss 4.0.5

The WSO2 Registry comes as a war distribution which can be deployed in a servlet container. If you are interested in deploying the WSO2 Registry on JBoss 4.0.5 this blog post by Bruno will help.

HTTP Content Negotiation with Apache Axis2

Since the 1.3 release of Axis2, it supports HTTP Content Negotiation. It is not turned on by default but can be done so by adding the following parameter to your axis2.xml.

<parameter name="httpContentNegotiation">true</parameter>

Axis2 does not honor the content-type text/xml when its in the Accept Header. This is because the content-type text/xml is primarily used for SOAP 1.1 but when a request is sent via the browser it has the Accept header as "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 ". If we were to honor text/xml this would result in a SOAP 1.1 response. Not too good for a REST scenario ha! This is the result of the same content-type (text/xml) been used for two message formats (SOAP 1.1 and POX).

Now lets get back to HTTP Content Negotiation with Apache Axis2. Performing a GET request on the version service would result in the following request and response. You could capture them by using TCPMonitor.

Now try editing the Accept header to "application/json/badgerfish". You should have enabled JSON support for this to work. This would result in,

A blog post on how to enable JSON on Axis2 will follow. This configuration can be used to enable HTTP Content Negotiation on WSO2 WSAS as well as the Mashup Server. It should work with Synapse and the WSO2 ESB too but I haven't checked it.

Wednesday, September 24, 2008

Mashup Server as a Teaching Tool

I've been involved in quite a few trainings in the recent past. Both on Axis2 as well as the Mashup Server. The newest on the list was a "Introduction to WSDL 2.0" training that I conducted yesterday. One of the cool tools that I have used in all these trainings is the Mashup Server. The Mashup Server makes it amazingly simple to to create services in a matter of minutes, whats more there is a bunch of resources thats auto-generate for each service.

For e.g I used my RESTDemo mashup extensively to describe how WSDL 2.0 enables REST.

Note : The RESTDemo Mashup does not cover all capabilities of WSDL 2.0. I intend to do a comprehensive write up of this soon.

One might wonder how the Mashup Server helps teach a person Axis2? Well to be frank the Mashup Server is a highly customized version of Axis2. We've used quite a few extension points in Axis2 to make the Mashup Server what it is. Hence its a great case study for the customizability of Axis2.

Saturday, September 20, 2008

WSO2 Data Services 1.0 Released!

The title says it all, after months of hard work the 1.0 version of the WSO2 Data Services Solution is out. This version of Data Services is based on carbon, which is based on OSGI. There were quite a lot of challenges that the Data Services team had to undergo in order to pull of this release.

Some key features of this release are,
  • Built-in Connection pooling support
  • Aggregate data from multiple data sources
  • Support for exposing Stored procedures & functions
  • Built-in caching to enhance performance
  • Throttling to ensure that your database is never overloaded
  • Secured access to data
  • Reliable delivery of messages
It also come with an eclipse IDE plugin.

For those who are not familiar with WSO2 Data Services is, it is a way to expose data locked up in Data Bases, Excel files or CSV files as Web Services in a matter of minutes. And it requires zero code (You could either use the wizard that comes with it or simple use your favorite editor to write your configuration).

Sumedha's blog has quite a few tips on Data Services. From doing basic stuff to more advanced scenarios.

As with all products at WSO2 the Data Services Solution is shipped under the Apache License. Download it and try it out.

Thursday, September 18, 2008

Web Services Framework for Jython Released!

WSF/Jython (Web Services Framework for Jython) is the latest addition to the impressive SOA stack at WSO2. It provides an amazingly simple approach to write web services as well as consume web services using Jython. As with all other products at WSO2, it is released under the Apache License hence you can download it and give it a try.

There are two packages that comes with this release, the server side and the client side.

Client Side Features

  • Support for invoking Web Services in a simple clean manner

  • Ability to use WS-Addressing when invoking services

  • Ability to invoke services which require WS-Security

  • Ability to send binary attachments using MTOM

Server side Features

  • Support for exposing services written in Jython

  • DataBinding support using a simple annotation mechanism

  • Automated WSDL generation

  • Ability to expose all enterprise features of Axis2 to services written in Jython
Here is one of the simplest services you could write. It contains a add method which would add two integers and return the result as an integer. The annotations are used to describe the actual data types that flow in and out of a function.

#@annotate("returns=int", "operationName=add", var1="integer", var2="integer")
def add(var1,var2):
return var1+var2

You could refer the article Deploying Python Services for more details.

Now lets see how easy it is to write a client for the service that we just wrote.

from org.wso2.wsf.jython.client import WSClient
from org.wso2.wsf.jython.client import WSFault
from org.wso2.wsf.jython.client import WSMessage

req_payload_string = "12"
END_POINT = "http://localhost:8080/axis2/services/simpleService"

client = WSClient({ "to" : END_POINT}, "")
req_message = WSMessage(req_payload_string, {})
print " Sending OM : " , req_payload_string
res_message = client.request(req_message)
print " Response Message: " , res_message

except WSFault, e:

You could execute this client by simple running the "wsfjython" shell script as follows,

sh wsfjython.sh /opt/software/wsf-jython-client-1.0-alpla/samples/myClient.py

For more details on writing clients and usage of advanced features please refer the article "Invoking Enterprise Web Services using Jython".

WSF/PHP - Use Cases Discussed

Katie having a discussion with Shankar (Lead developer of WSF/PHP) on what WSF/PHP (Web Services Framework for PHP) can be used for at ZendCon 2008.

WSF/PHP 2.0 was released just a few days ago.

Wednesday, September 17, 2008

Expose and Invoke Mashups over JMS

My article on Exposing and Invoking mashups using SOAP/POX over JMS with the WSO2 Mashup Server has been published on the WSO2 developers portal for SOA. It talks about how you could invoke mashups running on a WSO2 Mashup server over JMS and also how you could send JMS messages using a Mashup running on the server. You would me amazed to see how easy it is. The article contains sample code which help you get going in minutes.

JMS plays an important part in most enterprises and this open the door for enterprise mashups using the Mashup Server.

Get Twitter Friends Time Line Using a Mashup

Milinda has posted how to Get Your Twitter Friends Time Line Using libcurl. I thought of publishing a alternative mechanism to doing it. How about getting your twitter friends time line using the WSO2 Mashup Server? Well is pretty simple and straight forward. Here is the code (Just a few lines of code),

function getTwitterFriendsTimeline(){
var request = new WSRequest();
request.open("GET","http://twitter.com/statuses/friends_timeline.xml?count=5", false, "username","password");
return request.responseE4X;

Pretty simple ha! If you wanted you could have published this on mooshup and have it run for you 24*7 for you. Of course you might want to do something with this data to make it a useful mashup.

Apache Axis2 java2wsdl Usage - Graphical Tool

It seems that quite a few people are having trouble using the java2wsdl tool that comes with Axis2. Using a command line tool can be tricky for some users... but wait there is a graphical tool for this too. WSO2 WSAS (Web Services Application Server) has a graphical tool that wraps the java2wsdl utility in Axis2. You can either try it out by downloading WSAS (WSO2 WSAS is open source and available under Apache License v2.0) or if you are in a hurry you could try the java2wsdl graphical tool online. This tool takes you through a wizard like approach and is much easier to use (The tool hosted online is based on WSO2 WSAS 2.3 which is in turn based on Axis2 1.3 with a few bug fixes). You could fine a lot more tools that could help you at http://wso2.org/tools.

For the geeks who do not want to use the graphical tool this is how the command line utility can be used. Simple executing the java2wsdl script without any arguments would show you its usage,

keith@keith:/opt/axis2-1.4.1/bin$ sh java2wsdl.sh
Using AXIS2_HOME: /opt/axis2-1.4.1
Using JAVA_HOME: /opt/software/java/jdk1.5.0_06
Usage: java2wsdl [options] -cn <fully qualified class name>

where [options] include:
-o <output location> output directory
-of <output file name> output file name for the WSDL
-sn <service name> service name
-l <soap address> address of the port for the WSDL
-cp <class path uri> list of classpath entries - (urls)
-tn <target namespace> target namespace for service
-tp <target namespace prefix> target namespace prefix for service
-stn <schema target namespace> target namespace for schema
-stp <schema target namespace prefix> target namespace prefix for schema
-st <binding style> style for the WSDL
-u <binding use> use for the WSDL
-nsg <class name> fully qualified name of a class that implements NamespaceGenerator
-sg <class name> fully qualified name of a class that implements SchemaGenerator
-p2n [<java package>,<namespace] [<java package>,<namespace]...
java package to namespace mapping for argument and return types
-p2n [all, <namespace>] to assign all types to a single namespace
-efd <qualified/unqualified> setting for elementFormDefault (defaults to qualified)
-afd <qualified/unqualified> setting for attributeFormDefault (defaults to qualified)
-xc class1 -xc class2... extra class(es) for which schematype must be generated.
-wv <1.1/2.0> wsdl version - defaults to 1.1 if not specified
-dlb generate schemas conforming to doc/lit/bare style

Most often that not you wont be using most of these options. Assuming that your,
output directory is /home/keith/projects/axis2_rest/resources/
output Filename is StudentService.wsdl
service name is StudentService
classes are in the directory /home/keith/projects/axis2_rest/classes
service implementation class is prg.apache.axis2.StudentService
you need WSDL 2.0

your usage of java2wsdl would be,

sh java2wsdl.sh -wv 2.0 -o /home/keith/projects/axis2_rest/resources/ -of StudentService.wsdl -sn StudentService -cp /home/keith/projects/axis2_rest/classes/ -cn org.apache.axis2.StudentService

Tuesday, September 16, 2008

REST and WSDL 2.0 Discussion continues

In response to my blog post on using WSDL 2.0 to describe RESTfull services and Sanjiva's challenge Stefan has put forward 5 questions for me. Here are the answers to them.

Question: How does one one describe representation formats other than XML?
Answer: This can be done using the whttp:inputSerialization (for input messages), whttp:outputSerialization (for outgoing messages) and whttp:faultSerialization (for outgoing faults). The WSDL 2.0 Adjuncts spec defines three types of serializations. They are application/x-www-form-urlencoded, application/xml and multipart/form-data. Axis2 supports all three of these as well as JSON messages (This is how you can send JSON messages using the Mashup Server). At WSO2 we are considering doing a JSON binding for WSDL. If we had that in place even this could be described in a standard manner.

Question: How is content negotiation supported?
Answer: WSDL cannot describe this (neither do I expect it to), but we do have content negotiation support in Axis2. Due to some practical limitations we had to make it an optional feature. This can be made available by adding the following parameter to the axis2.xml.

<parameter name="httpContentNegotiation">true</parameter>

Question: How does one describe whether a URI parameter is a query parameter, path element, or matrix parameter?
Answer: There are a few properties and defaulting rules that help you achieve this. As my example shows parameters can me made to go in the path or query section using templates. An example template for sending the parameter "name" in the path segment would be "student/{name}" while sending a parameter as a query parameter would be "student?name={name}". This section in the adjuncts spec give a brief idea as to where the parameters not cited would appear. If application/x-www-form-urlencoded serialization is used on a GET all parameters not cited in the template would go in as query parameters. There is a additional property in WSDL 2.0 that helps you control this too. If you specify whttp:ignoreUncited="true" then all uncited parameters will be dropped.

What do you really mean by matrix parameters?

Question: Is there a way to describe response codes?
Answer: WSDL 2.0 does not allow you to specify the http response code of a outgoing message. Too bad we missed this (I wonder whether the working group had discussed this issue though). I guess this is the one thing that WSDL 2.0 missed. Hence I opened a issue against the spec. But WSDL 2.0 allows you to set http codes on fault messages. For e.g on a fault you could say whttp:code="402".

Question: What about describing hypermedia? :-)
Answer: In my example you would have noticed that I actually return a set of links to where the actual resource exist when invoking some operations. For e.g getAllCustomers would return links to the actual customers. I agree that there is something missing in here, a way to describe that accessing this link returned, would fetch you the customers details (Probably an annotation in the schema could describe this).

Stefan had mentioned the following in his post

"One of the interesting aspects is the try out page, which is generated from the WSDL. Essentially this means that metadata is used to generate the self-descriptive form; somewhat backwards from a REST perspective, but understandable given that the goal was to have an external description in the first place."

Yes the WSDL captures all the metadata of your service. Don't you think that there is a definite advantage in having a standard description for your service? This would enable users to build tools that would make life easy when accessing such services. The tryit is an good example of this. You could even build a UI for a service using a generated JavaScript stub. The UpgradeChecker sample on mooshup is a good example for this.

Its good to have a constructive discussion around REST, SOAP and WSDL rather than try to proclaim that one of them is the way to go and the other does not have a place.

Monday, September 15, 2008

Sending IM Messages via Yahoo using the Mashup Server

[Note: also published on the Mooshup.com blog.]

If you try to send IM messages using a yahoo account in the WSO2 Mashup Server you may encounter the following error.

Fault: Cannot find yahoo library in the class path. Please make sure its in the classpath.

The reason for this could either of the following,
  • The yahoo Library in not in your classpath - Download the latest version from YMSG
  • You have the yahoo library in your classpath but its an old version. You need to have the latest version in your classpath to get this working.
Now that you have the latest version of the Yahoo messaging library in your classpath its time to test it out.
Here is a simple client for sending a IM message via yahoo,

function IMExample(){
var im = new IM("yahoo");
im.sendMessage("keithgodwinchapman","Hi, This was sent from the WSO2 Mashup Server!");

For more details on sending IM messages using the WSO2 Mashup Server please refer the "Sending Instant Messages via Mashup Server" article.

You may have noticed that this sample is very similar to Sending MSN messages using the Mashup Server.
It is indeed the only difference is the argument you pass into the constructor of the IM host object. Have fun sending IM's using the WSO2 Mashup Server!

RESTfull Mashup with WSDL 2.0 - WSO2 Mashup Server

I was looking around for REST stuff related to Axis2 and stumbled upon one of Stefan Tilkov’s blog post (An old one at that). In that post Stefan had asked somebody to show a WSDL 2.0 document that describes this RESTfull scenario.

Too bad I didn't come across this back then, but as the saying goes better late than never. WSDL 2.0 can describe this scenario easily and I thought of writing a WSDL 2.0 document for this scenario (I've made one change to the URLS used in the scenario, instead of customer/{id}/orders I've used customerorders/{id}. This is not due to a limitation in WSDL 2.0 but rather the implementation of Axis2).

I put all these details together and built a little Mashup (which I named RESTDemo) that runs on the WSO2 Mashup Server. Of course the WSO2 Mashup Server has the ability to build RESTfull Mashups. In order to make it accessible to others I've uploaded it to Mooshup.com our community site.

Note : I have made some assumptions on how an Order and a Customer will be described. My assumptions is that an Order is described by an id (String), customerID (String), details (String), amount (Double), items (String array). A customer will be described as id (String), name (String), address (String), email (String).

The main objective of putting this Mashup together was to demonstrate that this RESTfull scenario can be described using WSDL 2.0. The WSDL 2.0 for this mashup can be accessed from the Mashup page, you could choose either the annotated view or the raw view.

The all important section in the WSDL is the HTTPBinding , cause this is where all the information for accessing this service via REST lies. Ideally I would have loved to make the content-type (whttp:inputSerialization in WSDL 2.0 terms) of a few of the operations application/x-www-form-urlencoded (WSDL 2.0 defaults it to application/xml) . But unfortunately as of now the Mashup Server does not offer a mechanism to do this. I've already opened a JIRA so that this could be added.

You might also want to try out our RESTfull mashup. Simply goto its tryit page in order to try it out (The tryit page allows you to test your mashup and a drop down at the top allows users to select the endpoint they want to access, in our case we may prefer to choose the HTTPEndpoint cause this is all about REST). Now this is where the benefit of a standard description (WSDL 2.0) for our RESTfull mashup kicks in. The tryit page is auto generated off the WSDL 2.0 doc (It has all the information as to how this mashup can be accessed, let it be SOAP 1.1, SOAP 1.2 or REST). The tryit page invokes the service using a auto generated JavaScript Stub.

Let me now explain as to why I had to change the URL mapping for get all customer orders. Axis2 (Which is what the WSO2 Mashup Server is built on) dispatches to the correct operation (when REST is used) using the http method and the URL of the request (The service is always found using the request URL). Now when we try to figure out the operation the request is headed to we basically do some pattern matching, and thats done against the first constant part we get off the httpLocation. In the scenario given it allows a GET on customer/{id}/orders as well as customer/{id}. Now if I used these two templates as it is, there would have been dispatching issues, hence I decided to change the second template.

This has become quite a long blog post. If you are interested in knowing how WSDL 2.0 can be used to describe RESTfull services stay tuned to my blog. I plan to write more on this topic in the time to come. Also there is a RESTfull services on Axis2 tutorial which is just around the corner.

Note : Mooshup is running the 1.5.1 version of the WSO2 Mashup Server (released before Axis2 1.4.1). There fore its REST URLs are of the format http://mooshup.com/services/keith/RESTDemo.HTTPEndpoint/customer/123, in the next version which will be based on Axis2 1.4.1 the URLs of the form http://mooshup.com/services/keith/RESTDemo/customer/123 would also work.

Sunday, September 14, 2008

XML Schema - Import or Include?

I'm sure people who work with XML Schema or WSDL for that matter have hit this issue at some point. The dilemma weather to use Include or Import? I came across this article that helps solve this problem. Hope that it will come in handy for you too.

Saturday, September 13, 2008

Basket Ball @ WSO2 in Full Swing

Work while you work,
Play while you play,
This is the way
To be happy each day.

Thats exactly what we do at WSO2, although we do play a bit while we work as well ;).

We are having a Basket Ball tournament at WSO2 these days. The tournament is in full swing as we draw near to the business end of the tournament, the Finals and Third place play offs. Quite a few of our guys (Tyrell, Ruwan Janapriya, Saliya) have been busy taking photos as well.

As with any tournament we've had our fair share of Injuries too. Sameera - a twisted ankle, Chanaka - a cracked lip, Sanjaya Ratnaweera - a dislocated wrist and the latest victim Sumedha with a sprained ankle. Oh and I almost missed poor Devaka who is suffering from a Sore finger and a sore toe ;).

I'm sure this first aid tips that Sumedha had got from his doctor would come in handy in the coming weeks.

Attachments - MTOM, SWA and Base64Binary Compared

Sending Attachments in Web Services is a common use case and there are various ways in which this objective could be achieved. Sending the Attachments as MTOM (SOAP Message Transmission Optimization Mechanism), SWA (SOAP with Attachments), or Base64Binary are some of your options.

Here is a simple comparison between these 3 options.
  • base64Binary sends the attachments as base64 inline in the SOAP message. i.e. The Attachment in embedded in the SOAP Message. Bloats the message by 33%.
  • SWA sends the Attachment outside the SOAP message (The SOAP message contains a reference to the attachment). But the SOAP infoset does not contain the attachment
  • MTOM Provides the best of both world. The Attachment is sent outside the SOAP message with a reference to it but the attachment appears as if it is embedded in the SOAP message (The SOAP infoset contains the attachment)
Due to the fact that attachments sent using MTOM appear as it the attachment is part of the SOAP message it allows you to use other WS-* QOS (Quality of Service) attributes. For e.g MTOM messages can be signed and encrypted using WS-Security. Thus this provides a mechanism to send Secured Attachments without the need for additional specs.

Axis2 as well as (WSO2 WSAS) supports all three of the above mechanisms. In a later post I will describe how each of the above can be used and how the actual wire messages look.

WSF/PHP 2.0 Released!

The WSF/PHP team has released the 2.0 version of WSF/PHP (Web Services Framework for PHP). This release promises a bunch of new and cool features. Some of the more prominent ones are,
Please refer the release note for the full list of features. You can also visit the PHP demo site for a feel of what WSF/PHP has to offer. It contains Code Samples, demos and tutorials.

You can also download the Stock Trader 2.0 demo which shows how WSO2 WSF/PHP, WSO2 WSF/Ruby, WSO2 WSF/Spring, WSO2 WSF/Perl, WSO2 WSF/Python and WSO2 WSAS inteoperates with the Microsoft .NET platform.

Thursday, September 11, 2008

Interactive Defence Map of Sri Lanka

Its no secret that there is a war going on in the northern part of Sri Lanka. This interactive Defence Map of Sri Lanka shows the recent activity that has been recorded from the war front. It even goes to show how the LTTE light Air Craft was attacked over Mullaittiuvu.

Axis2 java2wsdl - Never Use An Interface

Well this is not an issue with Axis2 but rather the way Java treats an Interface. There has been numerous occasions when users have been bugged by this (Parameter names appearing as param0, param1 in the WSDL instead of the actual parameter names). This could happen because of two reasons,
  1. Your service class was compiled without the debug option been turned on. Please refer How to make WSDL display actual parameter names? in order to see how this issue can be avoided.
  2. You used an Interface as the service class name when using java2wsdl. For this I'm sorry - there is no solution. Even if you had turned on the debug option when compiling the interface, java would not push down the parameter names into the compiled code (After all, its an interface and it just defines the contract and the actual class thats implementing this interface may have called those parameters something else)
So the bottom line is this. Always avoid using an Interface as the service class when using java2wsdl and when using a class, please make sure that its compiled with the debug option turned on.

Tuesday, September 9, 2008

Two Years at WSO2

The beginning of this month marked the completion of my second year at WSO2. Its been a great two years at that. Initially I was involved in helping improve the Axis2 IDEA plugging for the 1.1 release. This was my first steps with Axis2 and that helped me gain the committership for Axis2 later that year. The Axis2 1.1 release was a very important one and one of my batch mates Thilina was the release manager.

My involvement with Axis2 was propelled by the fact that I got the opportunity to attend the WSDL 2.0 interop in France which was held from the 14th to the 18th of November that year.

Members at the WSDL 2.0 interop.

This was just 2 months after I had joined WSO2. I went to the interop along with Chinthaka. We had the chance to pay a visit to the Eiffel tower as well as the world famous Louvre museum.
At Eiffel

At Louvre

By the time we went to the interop I was not too familiar with the internals of Axis2, I was just providing a helping hand to Chinthaka. But that trip threw me into the deep end of Axis2. The time frame given to the working group was to end on the 31st of December and they needed two independent implementations to pull the spec through. We were one of the implementations and we had more work to do, especially on the http binding. The other implementation was from canon and they were not interested in implementing the http binding (They did support us by implementing a subset of the http binding though) so we had the added pressure and to make matters worse (or you could look at it as provide me more opportunity ) Chinthaka was leaving for grad school early December. So I was charged with the responsibility of implementing these stuff. That was how I got into the internals of Axis2.

Although I worked on Axis2 full time at the start later on I moved on to work on the WSO2 Mashup Server. Even though I've been working on the Mashup Server ever since, I've always been in close proximity with Axis2. That has been for 2 main reasons. One is that I love working on Axis2 and the second been the fact that Axis2 is the foundation of most of the products at WSO2 including the Mashup Server.

Monday, September 8, 2008

Axis2 Training in Phoenix

Last week I was in the scorching heat of phoenix in order to conduct a 4 day training course on Axis2 along with Glen. This was the first time I had visited Phoenix. The temperature on Sunday (the 25th) was 43 Centigrades (we Sri Lankans are used to the metric unit system) and it was the first time I had experienced such a temperature. The first thing I noticed when I got out of the Sky Harbor airport in Phoenix was the scorching heat. The air smelt like something was getting roasted :-) , yes thats how hot Phoenix was.

My flight into Phoenix wasn't the most straight forward. It was Colombo, Narita, Dallas, Phoenix. Interestingly 5 of us (Manjula, Nandana, Dimuthu, Isuru and myself) were on the same flight to Narita and from there we went in 3 different directions. Manjula and Nandana were on there way to Seatle while Dimuthu and Isuru were headed to San Francisco and I was headed to Dallas.

The training itself was interesting. It was my first 4 day course. I had conducted tutorials and online training on Axis2 prior to this though and Axis2 was nothing new to me. Its amazing how easy it is to teach something that you've been playing with and developing for so long. Whats more I was conducting the training along with Glen who is a pioneer when it comes to Axis (both Axis and Axis2).
My flight back home was even worse that my flight into Phoenix. It was Phoenix, Dallas, Narita, Singapore, Colombo with a total travel time of close to 44 hours. It was an interesting co-incidence that all of us met in Narita on our way back as well. The others went to Singapore on a separate flight while my flight to Singapore was 2 hours after there's. And from Singapore to Colombo we were on the same flight :-)

Thursday, September 4, 2008

Invoking Mashups using JSON

Mashups running on the WSO2 Mashup Server can be invoked in using various message formats. They are SOAP 1.1, SOAP 1.2, POX (Plain Old XML), REST, JSON, SOAP/POX over JMS, SOAP/POX over SMTP.

Here is how you can use JSON to invoke a simple Mashup. In this example I will be invoking the RESTSample running on mooshup.com. This simple sample sends the payload as JSON and receives the response as JSON as well.

// Providing optional annotations
invokePOSTWeather.inputTypes={"city" : "string", "weatherDetails" : "string"};
function invokePOSTWeather(city, weatherDetails){
var request = new WSRequest();
var options = new Array();
// Instracts the server that my request needs to be formatted as JSON
options.HTTPInputSerialization = "application/json/badgerfish";
var payload = <POSTWeather><city>{city}</city><weatherDetails>{weatherDetails}
var result;
try {
request.open(options,"http://mooshup.com/services/samples/RESTSample/", false);
result = request.responseE4X;
} catch (e) {
result = e.toString();
return result

If you were to use TCPMonitor to trace the messages you will be able to see the messages sent and received by the Server.

Here is the request sent out by this Mashup


And the response it received


Note : There are three main ways that you can get the response from WSRequest. There are response.responseText, response.responseXML and response.responseE4X. If you were to use these variants when the response if JSON they will act as follows,

response.responseText - Would return the JSON string as the response
response.responseXML - Would return the XML representation of the JSON string
response.responseE4X - Would return the E4X representation of the JSON string

Wednesday, September 3, 2008

Sending IM messages via MSN using the WSO2 Mashup Server

[Note: also published on the Mooshup.com blog.]

If you try to send IM messages using a windows live account you may encounter the error reported in the JIRA MASHUP-1087. The reason for this is that the library we use to send IM messages via MSN (jml) is outdated. A newer version of this library was released on the 5th of August 2008 and is available here.

In order to get this working you need to download the 1.0b3 version of jml and drop it into the lib/patches folder of the WSO2 Mashup Server and restart it.

Here is a simple client for sending a IM message via MSN,

function IMExample(){
var im = new IM("msn");
im.sendMessage("keithgchapman@hotmail.com","Hi, This was sent from the WSO2 Mashup Server!");

For more details on sending IM messages using the WSO2 Mashup Server please refer the "Sending Instant Messages via Mashup Server" article.

Tuesday, September 2, 2008

Apache Axis2 1.4.1 Released

Yes the subject says it all. The main reason for putting out a 1.4.1 release a was security vulnerability present in Apache Axis2 1.4 policy processing. The 1.4.1 release fixes this security issue plus a few critical issues that were present in the 1.4 release.

Nandana who primarily works on Axis2 and Rampart noticed this security vulnerability and sent a note to the Axis2 list who decided to push for a 1.4.1. Of course Nandana volunteered to be the release Manager ;).

This exemplifies the beauty of Open Source. After all the Open Source mantra is "Release early, release often".