Showing posts with label XMPP. Show all posts
Showing posts with label XMPP. Show all posts

Wednesday, August 22, 2007

Bridging the Gap - XMPP to SIP Group Chat

As noted in one of my earlier blogs, we have been enhancing the XMPP BC to be able to participate in Group Chat Sessions. During this process we thought we would also show how you can utilize JBI to be a convergent platform and bridge gaps across protocols. To do this, we thought we would show how a SIP User Agent (e.g. an xlite soft phone) could participate in an XMPP Group Chat session. Brian O'Neill's blog talks a little more about utilizing JBI as a convergent communication platform, and provides a use case here.

Enough with the fluff, on with the demo. I've uploaded the Netbeans Projects here that I will be discussing in this blog so you don’t have to create them from scratch. Below is a list of prerequisetes in order to run the demo:

- You will need to get the latest OpenESB installer

o This comes with Netbeans, Glassfish, and the JBI Components you will need to run the demo.

- Set up an Openfire XMPP Server

o You can go here for a demo on how to setup Openfire

o You will need to get an XMPP client (e.g. Spark or Pidgin)

§ You can go here to see a demo of how to setup Spark

§ You will need to create one user in Openfire with the username sipua and password sipua (This is defined in the XMPP WSLDs

- Set up a SIP User Agent/SIP Server

o We used XLite for the demo, but you should be able to utilize just about any SIP UA and SIP Server.

o Login as a user (e.g. chad)

- Edit the XMPP WSDL

o Edit all xmpp WSDLs to reflect the correct domain (the domain of your Openfire server) and the correct groupChat name (e.g. A@conference.OpenFireDomain). Both attributes can be found in the xmpp:address section of the WSDL.

- Edit the SIP WSDL

o Edit all sip WSDLs to reflect the correct proxyDomain (sip:address section of the wsdl) (the domain of your SIP server)

- Edit the BPEL Process

o Click on Assign3 and edit the String A@conference.b-0498.int.gestalt-llc.com to be the groupChat name you defined in your XMPP WSDL’s earlier.

o Click on Assign1 and edit the String chad@10.9.5.62 to be whatever user you are logged in as (e.g. mySipUserAgent@mySipServerDomain).

You should be all set now. You will need to recompile the Composite Application by right clicking (in Netbeans) on SIPAndXMPPCA module and selecting “Clean and Build”. You are now ready to deploy your application. Follow the following steps to deploy and run the test.

- Start Glassfish

o In Netbeans Click Window à Services à Servers à Right click on Sun Java Application Server à Click Start.

- Start Openfire

o With an XMPP client (e.g. Spark or Pidgin (or Both)) log in, you may have to create an account first.

- Start SIP Server and SIP User Agent

o Using a SIP UA (e.g. XLite) log in as the user you defined in the Bpel Process above (e.g. chad@10.9.5.65).

- Ensure JBI Components are installed and started

o In Netbeans navigate to Window à Services à Sun Java System Application Server 9 à JBI

§ Under Service Engines verify the following Component is installed and started

· sun-bpel-engine

§ Under Binding Components verify the following Component is installed and started

· gestalt-sip-binding

· gestalt-xmpp-binding (uninstall this component by right clicking on the component and selecting "uninstall". We need to ensure you have the latest XMPP BC, you can find it here. Download the xmppbc.jar and install it by righ clicking on Binding Components and selecting Install New Binding Component. After Installation, make sure you start the XMPP BC (Right click and select Start).

o If the components are not there, you can download them here.

- Deploy the SIPAndXMPPCA by right clicking on the project and selecting “Deploy Project”

- Once deployed, you should be able to use your Spark or Pidgin clients and join the Conference room that was created (e.g. A). You should see yourself in the room as well as the user sipua. You can now send a message to the group and your SIP UA will receive the message. Have your SIP UA respond and see the message appear in the Group Chat.

So a quick recap of what we accomplished. First, we were able to create an application that could bridge two protocols that normally couldn’t speak to each other (See screenshot below). Second, we did this without writing one line of code. Yes, you read that correct. To do this application from scratch all you have to do is configure it, and then tell BPEL how to orchestrate it. Netbeans provides a nice way to do this with their toolkit support (automatically generating WSDL’s and leveraging the design view for the BPEL process to drag and drop activities on the screen)




If you have any questions feel free to shoot us an email by using our mailing lists (SIP BC, XMPP BC), or leave a comment on my blog.

Monday, June 11, 2007

XMPP to RSS Demonstration

As noted in my last blog, I have been working on some open source binding components. We recently finished the RSS Binding Component and I wanted to get one of the demonstrations we did out here as an example of how you can use JBI to tie multiple protocols together that would normally be somewhat difficult to do. So in this demonstration I use the XMPP BC to send instant messages, and take that message and publish it as an RSS Feed. You can download the Netbeans project here. Prerequistes to build this application are as follows:

OpenESB Installer
this comes with Netbeans, Glassfish with JBI Runtime, and JBI Components
Wildfire XMPP Server: for instructions on how to set up go here.
Spark XMPP IM Client: For instruction on how to set up go here.
XMPP Binding Component installed
RSS Binding Component installed
File Binding Component installed
BPEL Service Engine Installed

All of the Binding Components and the Service Engines come with the OpenESB installer. If you happen to be missing one you can find and download the component you need from here.

You will want to edit the WSDL's to fit your needs. First look at the fileWsdl.wsdl. You will notice that in the address section (file:address) you will be writting a file to you User Home/mag16AOC directory. You can edit this if you wish, and write the file where ever. Next look at the message (file:message) section of the WSDL and notice the file will be called mission100.xml. You can re-name the file if you wish.

Next look at the rssPublish wsdl, you will want to edit the feedUrl in the rss:address section to be specific to your machine (i.e. http://localhost:64801/feed/mag-16_aoc/mission_100). What this means is once you deploy this application and start sending instant messages, the messages will be published to the above link and you can view them using an RSS Reader (i.e. RSSOwl), or you can navigate to that link in a web page and view it there. Next look at the rssSubscribe wsdl. You will want to edit the rss:address section to be the same feedUrl you used above. What this does is subscribes to this feed and every time there is a new post you will get notified and the entry will be written to the file we described above.

Finally lets take a look at the xmppWsdl. You will need to edit the xmpp:address section to update the domain (i.e. localhost).

You can now clean and build the module in netbeans by right clicking on the project and selecting clean and build. With a successfull build you will want to right click on the XMPPtoRSSDemoCompApp and clean and build that. You are now almost ready to deploy these and test. You will first need to create a user for your spark client (This is assuming you have followed the instructions on how to setup Spark and Wildfire). Make sure you Wildfire server is running and start your Spark client. You will need to select "Accounts" and create a new user (i.e. bob, server is localhost). Once logged in you will want to pull up your Wildfire server Admin page and add a user. This user must be the same that is defined in the xmppWsdl (i.e. username = mag-16_aoc, passworkd mag-16_aoc), once this user is created you will want to add him as a contact in your buddy list for your Spark client. You are now ready to deploy and test.

Start the server in Netbeans ( Window --> Runtime --> Servers --> Right Click on Sun Java System Application Server 9 and select Start). Once the server is running you will see a Tab that says JBI, expand that and verify that under Binding Components you see the RSS Binding Component, XMPP Binding Component, File Binding Component, and under Service Engines verify you see BPEL SE. If those are in place you are ready to deploy your Composite Application. Right Click on the XMPPtoRSSDemoCompApp and select Deploy. Once successful you will see the buddy you added in your Spark client (mag-16_aoc) come online (i.e. turn green). You are now ready to send instant messages and have those messages published to an RSS Feed. Send a couple of messages and then navigate to the feedUrl you defined and verify the feed is being published. You can also verify your subscribe is working by navigating to the file and verifying that the file is being written to the location described in your fileWsdl.

So in short what we have done using JBI is the capability to "mash" two protocols together that could normally not happen, at least easily. This is a great example of how to take simple IM client and disseminate information to a large group of people. If you have any questions feel free to email me or use the mailing list on our project site for the RSS BC or XMPP BC