This tutorial by Yumani Ranaweera will take you through a couple of scenarios to demonstrate the instant messaging capability of the WSO2 Mashup Server. WSO2 Mashup Server currently supports basic IM capabilities such as real-time communication and instantaneous, simultaneous communication among different parties, by transmitting information quickly and efficiently.
Applies To :
| WSO2 Mashup Server | v1.0.2 onwards |
| Sun JDK | v1.5 |
Introduction
WSO2 Mashup Server
WSO2 Mashup Server is a product created to support developers to create and deploy java script Web Service mashups. It makes it easy to deploy a Web Service, and also to consume and combine information from other Web Services and expose the resulting mashup as a service. As mentioned in the Mashup Server documentation [1] also in detail, the server uses web services as its mechanism for acquiring data, XML as its central abstraction, Javascript with E4X extensions for manipulating that data and again Web Services as the primary way to re-publish the new information stream, with bridges to HTML, RSS, and other output mechanisms.
On the web mashup means consuming information published from multiple sources and integrating them into a new information stream. This is a a part of the Web 2.0 trend about decentralizing the power to the web consumer where it allows them to build their own customized view by mixing information from more than one source.
There are many samples shipped with WSO2 Mashup Server installation which illustrate this concept further. For example sample TomatoTube, (The Making of TomatoTube, Featuring The WSO2 Mashup Server [1]), is taking information about movie reviews from Rotten Tomatoes [2] site and the trailers of them from another community driven site, YouTube [3]. It then gives the top 10 rated movies along with their trailers as a web service.
Instant Messaging
Instant messaging, as most of us already know is a capability which offers real-time communication and allows easy collaboration across Internet. WSO2 Mashup Server from its 1.0.2 release introduced a capability for the javascript web service writer to include instant messaging in their web services. Through this it allows the instant messages to be sent via the java script services that you deploy in the Mashup Server. The instant messaging protocols supported by the WSO2 MAshup Server are MSN, AIM, ICQ, Jabber and Yahoo. Mashup Server provides this capability through a built-in object called IM host object.
The business scenario behind this is: say that you have a web service where you capture the latest academic information of an acadamic course that your following, and if there is an instance where a notice of an assignment submission date pops up, we can have our mashup to send us an instant message when such a notice occure and then to further configure it to keep up remind about the date until we disable it. Like wise there could be scenarios where somebody would need alerts or instant messages sent about weather updates, stock market statuses, country situation etc., sent to their PC while they are at work or study.
Blending this capability with various other host objects such as session, system, feed, APP, WSRequest, scraper, file, email etc., which the server is providing, you can create web services which meets your exact day to day information retrieval needs.
Table of Contents
- Prerequisites [3]
- First Steps [3]
- Scenario 1 [3]
- Scenario 2 [3]
- Scenario 3 [3]
- Scenario 4 [3]
- Scenario 5 [3]
- Conclusion [3]
Yahoo Instant Messenger & Chat Protocol library [4] copied onto the Mashup Server's lib folder. Please note that you will need to restart the server after doing so.
WSO2 Mashup Server version 1.0.2 [5] or above.
Unzip the downloaded .zip distribution to your file system.
Go to the MASHUP_HOME/bin folder of your installation and execute the startup.bat/.sh file to start the server.
Access the admin console via https://localhost:7443
At the very first access the WSO2 Mashup Server admin console will prompt you to create an admin user. Complete the initial registration by following the on-screen tips.
TIP: Once the user account is created, you will have a folder inside MASHUP_HOME/Scripts in the name that you used to create the above user account. Thereafter, every service you create from this user login will be stored in this folder. See the image below:

Image 1: Mashup sever folder structure with the user specific repository created.
In our tests, we will deploy all our services under the user account we just created. In Mashup server there are two ways to create and deploy a service:
- Create and deploy a Java script Web service from the Mashup Server UI.
- Copy the Java script Web service directly to the file system, from which the server will pick up Web service for deployment.
I will use the second approach which limits UI interactions, which is also the faster approach. So lets move on to the test scenarios. We will start with the basics and move on to more complex scenarios.
The Mashup code segments are already made available in this tutorial. Please change the <SENDER_ID>, <PASSWORD>, <RECEIVER_ID> tags to reflect correct user information, before you deploy the services.
Mashup Server Document index [6].
WSO2 Mashup Server User Documentation [6]
Author
Yumani Ranaweera, Senior Software Engineer, WSO2 Inc. yumani@wso2.com