Skip to main content

Configure WSO2 ESB with XMPP transport

This post explains main steps which required to configure WSO2 ESB with XMPP transport support. For this I am using Openfire, Instant Messaging chat server that implements the XMPP protocol. Here I am working on Linux OS and you have to change commands according to your OS.
  • Then Extract the openfire distribution and go to the folder "openfire/bin".
  • Now you can run the openfire server using following command in command prompt
    ./openfire start
  • After that you can setup openfire. For that you have to use type following URL in your browser.
  • With this setup you can add server settings including domain, database settings, Profile Settings, and Administrator Account. Following are the settings with my setup.
    Domain – localhost
    database settings – Embedded database
    Profile Settings – Default
    Administrator Account – Username: admin Password: admin
  • Now the openfire setup is completed and if you want you can do any configuration changes by logging in to openfire admin console. (For this you need to restart openfire server)
  • Lets configure ESB with XMPP transport by editing axis2 xml file in ESB. For this you have to add following configuration to ESB_HOME/repository/conf/axis2.xml (You need to change xmpp credentials according to xmpp your account)
    <transportReceiver name="xmpp" class="org.apache.axis2.transport.xmpp.XMPPListener"> 
    
    <parameter name="MyServer"> 
    
    <parameter name="transport.xmpp.ServerUrl">localhost</parameter> 
    
    <parameter name="transport.xmpp.ServerAccountUserName">admin</parameter> 
    
    <parameter name="transport.xmpp.ServerAccountPassword">admin</parameter> 
    
    <parameter name="transport.xmpp.ServerType">transport.xmpp.ServerType.Jabber</parameter> 
    
    </parameter> 
    
    </transportReceiver> 
    
    <transportSender name="xmpp" class="org.apache.axis2.transport.xmpp.XMPPSender"> 
    
    <parameter name="transport.xmpp.ServerUrl">localhost</parameter> 
    
    <parameter name="transport.xmpp.ServerAccountUserName">admin</parameter> 
    
    <parameter name="transport.xmpp.ServerAccountPassword">admin</parameter> 
    
    <parameter name="transport.xmpp.ServerType">transport.xmpp.ServerType.Jabber</parameter> 
    
    </transportSender> 
    
  • Then add smack-3.0.4.jar and smackx-3.0.4.jar libs to ESB_HOME/repository/components/lib folder.
  • Thats all about initial configuration. Start the ESB server and check the status.

Comments

  1. Good instructions, they are working for me but where to find example on the usage?
    I would like to:
    - intercept messages written in a chat room, transform them with an xslt and send as soap message
    - Receive a soap message, unwrap the content and publish it on a char room.

    thanks in advance
    Vincenzo

    ReplyDelete
  2. Hi,

    First of all sorry for the late reply. I wanted to share this post because it can be helpful if someone writing a carbon component which using xmpp as the transport medium for any purpose. These instruction not targeting any specific sample.But of course if you are interested you can write your own carbon components based on carbon platform and contribute to the community too.

    Cheers,
    Ranga.

    ReplyDelete
  3. Hi,

    thanks for the instructions!

    So far I've set up a WSDL based proxy and could configure XMPP as a transport.
    The endpoint looks like: xmpp://wso2@null/services/GlobalWeather
    How to configure the correct server instead of "null"?
    In openfire the ressource is shown as: wso2@robovm/soapserver326927531 such that I can send an IQ to that ressource but not to the WSo2 endpoint giving me an IQ reply with "feature-not-implemented".

    Is there any possiblity to trace what's going on inside WSo2 when an XMPP arrives (if it really arrives?).

    Another - not that important question - would be how to use the newest smack version 4.0?

    Thanks,

    Chris.

    ReplyDelete

Post a Comment

Popular posts from this blog

How to install IBM WebSphere MQ on Ubuntu (Linux)

Following are the steps to install IBM WebSphere MQ version 8 on Ubuntu 14.04. 1) Create a user account with name "mqm" in Ubuntu. This should basically create a user called "mqm" and usergroup called "mqm" 2) Login to "mqm" user account and proceed with next steps 3) Increase the open file limit for the user "mqm" to "10240" or higher value. For this open "/etc/security/limits.conf" file and set the values as bellow. mqm       hard  nofile     10240 mqm       soft   nofile     10240 4) Increase the number of processes allowed for the user "mqm" to "4096" or higher value. For this open "/etc/security/limits.conf" file and set the values as bellow. You will need to edit this file as a sudo user. mqm       hard  nproc      4096 mqm       soft   nproc      4096 5) Install "RPM" on Ubuntu if you already don't have it. sudo apt-get install rpm   6) Download

How to use Dynamic Registry Keys with WSO2 ESB Mediators

From this post I will going to briefly introduce about one of the new features provided by WSO2 ESB . Earlier WSO2 ESB supported static registry keys where users can select a key for the mediator as a static value. But from ESB 4.0.0 users can use dynamic registry keys where users can define XPath expression to evaluate the registry key in run time. For an example let's consider XSLT mediator. With earlier static registry key based method user have to define only single XSLT file for transformation. With the use of dynamic registry key, user will be able to use XPath expressions to dynamically generate the registry key, based on the message context. So with that user can have multiple XSLT files and based on the evaluated key mediator will be able to select the required XSLT file in run time. Following is a sample usage of static and dynamic registry keys and user can use both of them according to situation.   Static Registry Key – define the exact path to find the xslt fil

Creating a Simple Axis Service(.aar file) and Deploy it in WSO2 Application Server

In this post I am explaining how to Create a Simple Axis Service(.aar file) and Deploy it in WSO2 Application Server using a simple sample. And also at the end I am describing how to do the same thing with creation of a Jar Service. Lets assume "sample-home" as our parent directory and inside that we can create following folder structure. With this folder structure we can include our external libraries (jar files) inside lib folder and  the "services.xml" file inside "META-INF" folder. Following is the sample services.xml definition which I used with this sample creation. < service name = "HelloService" > < Description > This is a sample service to explain simple aar service </ Description > < messageReceivers > < messageReceiver mep = "http://www.w3.org/2006/01/wsdl/in-out" class = "org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> </ messageReceivers > < parame