Client Side Implementation of SynchronaWS

0

Category:

Openfire act as a client for SynchronaWS. In the previous blog post i have explained how a client can be written using SAAJ client implementation method. when we dig more in to the details on client implementation we found that there are technologicaly more advance client side implemenations availale for webservices, those are JAXM and client implementation using AXIS2. i have explained the steps for implementing client using axis2 for Synchrona webservice.

create a dynamic webproject called SynchronaWebService

File - > new -> Other -> select web -> select dynamic webproject.

crealte packe stucture com.synchrona.communication and four classes Communication.java , Synchrona.java , Twitter.java and Bloger.java as in the following image.

(--
for creating dynamic webproject follow the following tutorial

http://24bytes.com/helloworlds/WebService/hellowebservice.html
--)













Make sure to use apache tomcat 6.0 and axis2 1.4 for tutorial Make sure to set Dynamic web module version to 2.4 Make sure to click on default configuration and select axis2 from the pop up window and apply the settings in the process of crating dynamic web project

Now you have created dynamic webproject !!!
----------------------------------------------------------------------------------------------------------------------------------------
next step is to convert it in to webservice.

File -> new -> other -> select webservices -> select webservice and clieck OK

in the pop up window set the following configuration details.












set the service implementation :- com.synchrona.communicaton.Communication check whether server is tomcat :- 6.0 check whether axis :- 1.4 check whether serviceProject - SynchronaWebService click on webservice runtime and select the option :- start axis before tomcat server

click next -> next -> ...

you will find a button to start server click on it and click finish.

Right Click on SynchronaWebService -> select run -> select run on server

Now You Have Created SynchronaWS !!!

you will get following out put on eclipse browser window













Click on Communication , you will get the wsdl file generated for your webservice.
http://localhost:8080/SynchronaWebService/services/Communication?wsdl

you will need if for creating client stubs.
----------------------------------------------------------------------------------------------------------------------------------------
Creating Stubs for SynchronaWS

start terminal
if you haven't set the $JAVA_HOME
type following command in the terminal

$export $JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16

if you haven't set the $AXIS_HOME
type following command in the terminal
$export $AXIS_HOME=/home/kapila/Desktop/axis2-1.4.1

now follow the following steps to create client stubs

sh $AXIS2_HOME/bin/wsdl2java.sh -uri http://localhost:8080/SynchronaWebService/services/Communication?wsdl

-o SynchronaClient -u

you will get following output
kapila@kapila-laptop:~$ sh $AXIS2_HOME/bin/wsdl2java.sh -uri
http://localhost:8080/SynchronaWebService/services/Communication?wsdl
-o SynchronaClient -u
Using AXIS2_HOME: /home/kapila/Desktop/axis2-1.4.1
Using JAVA_HOME: /usr/lib/jvm/java-6-sun-1.6.0.16
Retrieving document at 'http://localhost:8080/SynchronaWebService/services/Communication?wsdl'.
kapila@kapila-laptop:~$
go to home folder and find the generated stub in SynchronaClient folder.

Stub will be saved to a folder called SynchronaClient

before importing generated stubs in to openfire test it on simple java applicatoin as follows.

File -> new -> Other -> JavaPrject

name the project as SynchronaClientTester

copy the src folder in the stubs generated folder to the SynchronaClientTester folder.

Refresh the SynchronaClientTester project
you should get following output












right click on the SynchronaClientTester Package and add new class called Tester.java

YOU WILL GET BUNCH OF ERRORS

right click on SynchronaClientTester and select properties and select buildpath and select libraries tab and click on add external jars. add libraries which are there in AXIS2 lib folder in to SynchronaClientTester.

if you still get the errors , go to Project -> Clean -> select SynchronaClientTester and click clean

now put following code in to the class (just copy paste)

public static void main(String arg[]) {

try {
CommunicationStub sample1ServiceStub = new CommunicationStub();
sample1ServiceStub
._getServiceClient()
.getOptions()
.setProperty(Constants.Configuration.TRANSPORT_URL,
"http://localhost:8080/SynchronaWebService/services/Communication");
sample1ServiceStub._getServiceClient().getOptions().setProperty(
HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
SynchronizeData syncData = new SynchronizeData();
syncData.setUpdate("Synchrona Test with new webservice");
SynchronizeDataResponse response = sample1ServiceStub
.synchronizeData(syncData);
System.out.println("Got param ==> " + response.get_return());
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
} catch (java.rmi.RemoteException e) {
e.printStackTrace();
}

}

Tester class should look like follows












Now you have created a client !!!
Run it and see the output

you will get following output on eclipse console , YOU HAVE DONE THE HARD PART !!!
WARN No appenders could be found for logger (org.apache.axis2.description.AxisService).

log4j:WARN Please initialize the log4j system properly.

Got param ==> Synchrona Test with new webservice
-----------------------------------------------------------------------------------------------------------------------------------------

Adding Client Implementation in to the Openfire motd plugin, this is tricky part of this tutorial

right click on motd package and select refactor and copy the package stuructur
org.jivesoftware.openfire.plugin

go back to SynchronClientTester and click on package and select refactor and paste the org.jivesoftware.openfire.plugin there. now SynchronaClientTester will get package structre similar to motd in openfire.

Copy copy and paste following classes in to motd package. YES DO IT

YOU WILL AGAIN GET BUNCH OF ERRORS!!!
now go to motd implementation folder and creae lib foder there
add all the libraries in axis2/lib folder in to that folder.

right click on project openfire -> select properties -> select build path -> select libraries -> click on add external jars -> all all the libraires that you put in to motd lib folder

affter this is done copy the code in inside Tester class in to MotdPlugin.java 's packetIntercepter method.

NOW EVERY THIS IS DONE!!!

you shoudl get a window as follows













Now Build the motd plugin throuh following commands

Run -> External Tools -> motd

this will create motd jar in the following works folder of openfire project.

upload that jar to openfire server and enjoy!!!!





Communication path set up between Openfire and WS

0

Category:

Synchrona System has three main subsystems named as SynchronaWS, Openfire extension and Browser plugin,

In this Blog post i have described how we crated the communication path between openfire server and webservice.

I took 2 main approches for creating client for a webservice, following is the tutorial which explains how to setup a Simple webserive and Clinet. But My focus was to develop a client which can act as a client for Synchrona WebService and also it can act as a plugin for Openfire Server.

When implementing client which handles soap mesages, all the tutorials you find in the web explains that clinet need to be running as a dynamic webservice , which in turn hilight the fact that clinet will be running on server such as tomcat or jboss or any other supporting server for WS. This fact rais the question of modeling the client implementation as a openfire plugin which has predefined structre for plugin development. This means that we should have some other way where it can run as a normal jara program without all of this servers and java libraries.

Solution we found was called SCCJClient. Client side of the openfire server is implemented according to the specification of SCCJClient

You can find more information on implementation of SCCJClinet form Here
...

Work done on Real Time Notification service of Synchrona

0

Category:

Synchrona will provide two main functions to its users.


1. Synchronizing user updates across different internet services.
2. Sending real time notifications about user updates to user contacts.

For real time notification sending Synchrona will utilize Openfire server ( an opensource XMPP server - http://www.igniterealtime.org/projects/openfire/).

We started development of the Real Time Component (RTC) of Synchrona by extending the functionality of Openfire server. One extension was to connect Openfire with Synchrona webservice to enable the data synchronization with different internet services. The other extension was to expand the real time notification facilities of Openfire. We needed broadcast user updates to all the users contacts, no matter what service they are on (fb, twitter, msn, gmail etc..).

Starting work..

I worked on extending the RTC in Openfire. First I installed the IM Gateway Plugin ( a plugin provided by Openfire community) on Openfire server. Next I modified the broadcast functionality of Openfire server to broadcast message sent to 'synchrona' XMPP address on server to all contacts of the user (this includes Spark, Gmail, Yahoo and MSN contacts). The packet interceptor method of the server was modified to capture messages sent to 'synchrona' XMPP address and the broadcast method was modified to broadcast these messages to all contacts.

I have uploaded the code to the Synchrona Google Code project here.

IDE used for development was Eclipse. The main development guide followed is listed below..



IM gateway plugin for openfire

0

Category:

Openfire which is an implementation of Extensible Messaging and Presence Protocol (XMPP), a set of open XML technologies for presence and real-time communication developed by the Jabber open-source community. What is IM gateway plug in and how it relates to openfire? These are the primary questions that comes first in to account, following gives primary objective of IM gateway plug-in and how IM gateway plug-in enhance functionality of openfire.

The IM Gateway plug-in for Openfire provides connectivity to other IM networks (AIM, ICQ, IRC, MSN, Yahoo, etc). Project synchrona is not aiming at providing the functionality with is provided by IM networks, it's major goal is to enhance the functionality or services of existing internet services through real time messaging and data synchronization among services. That is how synchrona is different form others. So what basic question is how IM gateways can help synchrona for achieving this objective. currently we can find IM gateways which are working well with Openfire and some are currently in developement. These existing and working IM gateways allow openfire to retrive a given users friend list , basically you will be able to see your friends in Facebook in opefire client like spark, samePlace.

IM gate way for twitter.

http://blog.wolfspelz.de/2008/09/twix-twitter-to-jabber-xmpp-gateway.html

IM gate way for facebook and MySpace

But for with these implementations synchrona will provide IM gate way plugin for moodle and blogger and many other services.