Sunday, January 21, 2018

An unexpected error occured, message = Evaluation of the XPath expression

XSLT 2.0 functions such as the 'replace' function could produce the above error.

In WSO2 ESB this was fixed simply by enabling XSLT 2.0 by uncomment the following in 'conf/'


But in EI this could cause the following error:

javax.xml.transform.TransformerException: DOM Synapse XPATH variable resolution failed

This could be resolved by adding the following to


Still in the integrator profile this could result in the following:

Fatal error occurred in stylesheet parsing : javax.xml.transform.TransformerException: Could not find function: replace

This can be solved by doing the following:

Remove(rename to _bkp) the following jars:

(EI version: 6.1.1)


Thursday, March 30, 2017

Device Grouping - WSO2 IoT Server Mobile Device Management (MDM) Features

The WSO2 IoT server is an extensible version of the product previously known as the WSO2 Enterprise Mobility Manager. The IoT server inherits all Mobile Device Management (MDM) features as well as Mobile Application Management (MAM) features from the WSO2 EMM and supports Android, iOS and Windows mobile platforms. The significant additions that come with the IoT server are out-of-the-box support for well-known development boards such as Arduino UNO and Raspberry Pi and the ability to be extended to support any type of device through device agent implementations.

In this post we'll take a look at the Device Grouping functionality in IoT server 3.0.0. The WSO2 EMM product already provided means to group users based on roles (this is because WSO2 products use role-based authentication). For example all managers could be assigned the Manager role. It was then possible to apply policies and provision applications (Enterprise app installation) based on user roles. The IoT server goes one step forward by providing Device Grouping. With device grouping you can group a set of devices immaterial of the users or user-roles of the device owners. You can then apply policies to a specific device grouping.

Login to the device management console and go to Group Management
You will see a list of existing devices. By default the system would have created a grouping for all BYOD devices.

Click on Add Group to create a new group

 Enter a Group Name and Description and click Add

Now the group has been created. You can add devices by either going to the device management console or by clicking Assign from My Devices in the group summary (this will also direct you to the device management console.

Click on the Select button, then click on the devices you want to add to select them, and then click Add To Group. You will be prompted with a drop-down to select the group to add the devices.

Once you've added the devices they will show in the Device Group summary.

The device group summary also has options to search devices based on device name, owner, active status, platform and ownership (BYOD or COPE). Furthermore, the Advance Search option allows you to search by device location and by advance search parameters such as Device model, Vendor, OS version, internal memory, SSID, CUP Usage etc. and allows AND & OR operators in the search query. 

Tuesday, December 6, 2016

Data Analytics with WSO2 Analytics Platform

Data Analytics and Visualization is a key requirement for any organization today. Proper Analytics and Visualization of data helps make better informed business decisions, reduce losses and increase profitability.

Data Analytics requirements can vary depending on what kind of data you need to analyze, the input mediums as well as the urgency of when it needs to be analyzed and acted upon.

Today any organization would produce a large amount of data. This data could be complex, scattered and transmitted through multiple mediums and protocols. Capturing this data and conducting analysis on large sets of structures and unstructured data could be a daunting task.

Furthermore, there are occasions where data needs to be analyzed as they are produced in real time.

In other cases it is required to predict future events or trends based on historical and current data.

And in all cases data visualization is a key aspect. Interactive dashboards would make it easy for users to interact with data using functions such as sort and filter and make the decision making process much easier. 

What WSO2 offers:

WSO2 offers a complete Analytics Platform that provides solutions for all the aforementioned use-cases. The WSO2 Analytics platform offers the following:

Batch Analytics
Analyze a set of data collected over a period of time.
Suitable for high volumes of data.

Real-Time Analytics
Continuous processing of input data in real time.
Suitable for critical systems where immediate actions is required e.g: Flight radar systems

Interactive Analytics
Obtaining fast results on indexed data by executing ad-hoc queries

Predictive Analytics
Predict future events by analyzing historical and current data

Batch Analytics

Lets look at Batch Analytics in the perspective of Big Data.

What is Big Data ?

“Big data is a term for data sets that are so large or complex that traditional data processing applications are inadequate to deal with them”    - (Ref: Wikipedia)

Why Analyze Big Data ?

  • Make informed Business decisions - make decisions based on patterns emerging from analyzing historic data
  • Improve customer experience - discover customer preferences, purchasing patterns and present the most relevant data
  • Process Improvements - identify areas of the business process that needs improvement 

Example: Better customer experience in airline seat reservation/allocation

Automatically allocate seats to customers based on their previous seat booking preferences by analyzing historic data related to seat reservations.


img ref:

Real Time Analytics

Identify most meaningful events within an event cloud
Analyze the impact
Acts on them in real time

Example: City Transport Control System - Analyzing traffic, monitor movement of buses, generate alerts based on traffic, speed & route
img ref:

Predictive Analytics:

  1. Machine Learning
  2. Other approaches such as statistical modeling
Machine learning is the science of getting computers to act without being explicitly programmed - (ref:

Example: e-Commerce sites use predictive analytics to suggest the most relevant merchandize, increasing sales opportunity

img ref:

Thursday, November 10, 2016

Containerization on Android devices with WSO2 Enterprise Mobility Manager (EMM)

Data security is one of the main concerns of organizations today. With the increasing use of mobile devices for work organizations are faced with the challenge of protecting confidential corporate data that is accessible through mobile devices.

If the organization allows corporate data access only via COPE devices, then they would have control over the device as well as the ability to perform security measures such as device wipes if the device is lost. However, in most organizations employees are allowed to access company data (e.g: email, shared drives etc.) on their personal devices. This is more cost effective for the company as well as helps improve the productivity as well.

However, allowing data access on BYOD raises concerns on both sides. From the organization point of view they are concerned about data security and need to implement measures such as limiting certain apps and enabling features such as remote device wipe. On the employees point of view they are reluctant to allow the organization gain total control of their device and allow app restrictions and remote wipe.

With version 2.2.0 WSO2 EMM will provide a solution to this problem using containerization using 'Android for Work'. With Containerization you can maintain a separate space within the device for corporate apps/data. This container provides total data isolation and can be managed separately by the organization. With this approach the company will not be able to access the personal space of the user's device, but would be able to manage the work profile. For example the company may decide to disable some apps on the work profile, but that would not prevent the user from using those apps in his/her personal space. There will be no data or context sharing between the apps run within and outside of the work profile. The work profile will be saved as encrypted files on the device. Therefore, the corporate data cannot be accessed outside of the container. If the organization wishes they can remote-wipe the corporate data on the device; this would not however effect the users personal data outside of the container.

Thursday, July 21, 2016

Publishing and Reading from JMS Queue using WSO2 ESB and WSO2 Message Broker

Integrate WSO2 ESB and MB using the following instructions:

Be mindful to uncomment the  transportReceiver relevant to WSO2 MB which has  the comment "JMS transport support with WSO2 MB [version]".

Reading from a queue using an ESB proxy:

Create the following ESB proxy:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns=""
         <property name="OUT_ONLY" value="true"/>
         <address uri=[enter uri to foward the message to a specific uri]/>

This will create a proxy named validRequests as well as a JMS queue named validRequests in the message broker. You can view this queue by logging into the WSO2 Message Broker and navigation to 'List' under 'Queues'

If you want to read from an existing queue you can simply create the proxy with the same queue name 

Writing to a queue from the ESB:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns=""
         <property name="OUT_ONLY" value="true"/>
               <address uri="jms:/validRequests?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=repository/conf/;transport.jms.DestinationType=queue"/>
   <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>


This creates a proxy service that would simply forward the request to a JMS queue on WSO2 MB named "validRequests"

The property named OUT_ONLY indicates that the ESB will not return a response and will only do an out only invocation from the proxy service.

Creating a queue without creating a proxy:
To create a queue without creating a proxy add it in E:\WSO2\ESB\wso2esb-4.9.0\repository\conf\ OR simply add it through the MB's management console.


Thursday, April 28, 2016

Android Device Registration on WSO2 Enterprise Mobility Manager

EMM Configs:

Before we proceed we need to make the following config changes

Change the LBHostPortPrefix and ServerUrl values from localhost to server IP at

Change the host value under generalConfig from localhost to server IP at

Add SMTP configurations:

Add the following code to the axis2.xml which is located at <EMM_HOME>/server/repository/conf/axis2
[1/8/16, 2:06 PM] Milan Perera (<transportSender name="mailto"
        <parameter name="mail.smtp.from"></parameter>
        <parameter name="mail.smtp.user"></parameter>
        <parameter name="mail.smtp.password">abc123</parameter>
        <parameter name=""></parameter>

        <parameter name="mail.smtp.port">587</parameter>
        <parameter name="mail.smtp.starttls.enable">true</parameter>
        <parameter name="mail.smtp.auth">true</parameter>

Create User

Go to https://<server_ip>:9443/emm

log in to the console (default admin/admin).
Click on Add under USERS
Fill in the information. The last field asks you to enter a user role. If you have a user role you can directly define it here. Creating a role will be discussed in the next section below.

Once you submit an email will be sent to the specified address with the EMM Agent download URL. And also a screen will appear with a QR code that embeds the download URL as well.

Once this is done you can download the EMM Agent to your mobile device using the URL.

To register agent, follow steps given in [1] below:


Once you register your device it will show up under Device Management in the EMM Console

By clicking on the view icon under the device you can view all device management options for the device:

Saturday, April 23, 2016

In and Out of JMS queue using WSO2 ESB

In this example we'll take a look at inserting a message to a JMS queue via a proxy service in WSO2 ESB, and how to pull it from the queue using an Inbound Endpoint

Part 1: Get Message From Queue

For the first part we will be using Sample 901 which ships with ESB 4.9.0.

Install ActiveMQ and follow steps in the following sample 901:

For the first part you need to start the ESB with Sample configuration 901.
in <ESB_HOME>/bin
wso2esb-samples.bat -sn 901 for Windows

./ -sn 901 in Linux

Deploy SimpleStockQuoteService:

Run ant from <ESB_HOME>/samples/axis2Server/src/SimpleStockQuoteService

Then start the Axis2 Server at <ESB_HOME>/samples/axis2Server and send a message to the queue as shown in the sample.

Output - you will see a stock quote for IBM generated  in the Axis2 Server console.

Part 2: Put message to queue using proxy service

Create a pass through proxy and modify the source configuration with the following:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns=""
         <property name="OUT_ONLY" value="true"/>
         <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
               <address uri="jms:/ordersQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://;transport.jms.DestinationType=queue"/>

The above is a pretty simple configuration that will forward the message sent to the proxy to the JMS queue.

You can get the WSDL file for the proxy service and invoke the proxy via SoapUI with the same payload shown in Sample 901. The end-to-end scenario will be when you send a message to the proxy the proxy will forward it to the JMS queue, and the inbound endpoint will pick it from the queue and send it to the SimpleStockQuoteService