Saturday, September 13, 2008

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"};
invokePOSTWeather.outputType="#raw";
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}
</weatherDetails></POSTWeather>;
var result;
try {
request.open(options,"http://mooshup.com/services/samples/RESTSample/", false);
request.send(payload);
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

{"POSTWeather":{"city":{"$":"col"},"weatherDetails":{"$":"10"}}}

And the response it received

{"ws:POSTWeatherResponse":{"@xmlns":{"ws":"http:\/\/services.mashup.wso2.org\/RESTSample?xsd"},"return":{"$":"col"}}}

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.login("username@live.com","password");
im.sendMessage("keithgchapman@hotmail.com","Hi, This was sent from the WSO2 Mashup Server!");
im.disconnect();
}

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