Tuesday, May 23, 2017

WSO2 ESB message flow

This post explains the message flow of the synapse which is the main building block of WSO2 ESB.

Synapse receives the message from the axis2 transport layer. Inside this transport layer, message will be built based on the content type of the message and then passed over to the Synapse. 

Following is the Inflow of the message from the entry point to synapse,



Inside the Axis2FlexibleMEPClient.send() method, a callback is registered in axis2 transport layer and message is dispatched out of the synapse. Then the axis2 transport layer format this message based on the content type and send it to the backend.

When the response is coming from a backend service, transport layer identifies this and synapse response path is invoked.

Following is the synapse response path,



This completes the message flow for the following proxy service configuration.



Monday, May 22, 2017

Processing Binary Data from TCP transport in WSO2 ESB

This post describes how to process binary data over TCP transport in WSO2 ESB.


  • First we need to enable binary transport. Add following entries in ESB_HOME/repository/conf/axis2/axis2.xml. 

  • Now you need to add the message formatters and message builders to be used. Since we are using binary data, add following entry inside messageFormatters element. 
          Add following entry inside messageBuilders element. 

  • Now you can add a tcp proxy service to process the message. In that proxy service you need to add the same content type used in messageFormatter and messageBuilder configs. There are several other parameters specific to TCP proxies. Refer [1] for more info on that. Following is a sample proxy service that prints the binary message. 

  • Now you can invoke this proxy service using a sample TCP client. End of message should be marked with a "|" symbol in this particular proxy service. 

Thursday, March 9, 2017

Installing new features to WSO2 EI

In WSO2 Enterprise Integrator, you cannot install new features via management console. That option has been removed. So in order to install a feature, we must use the POM based feature installation. This is explained in WSO2 docs [1]. There few changes you need to made in order to this POM.xml to work.

  • The "destination" element value should be changed to, "wso2ei-6.0.0/wso2/components".
  • Value of the "dir" attribute in "replace" element should be, "wso2ei-6.0.0/wso2/components/default/configuration/org.eclipse.equinox.simpleconfigurator".
Optionally, Other than downloading p2 repo (which is over 2GB), the URL to P2 repo "http://product-dist.wso2.com/p2/carbon/releases/wilkes/" can be set as "metadataRepository" and "artifactRepository".

Following is a sample pom.xml that is used to install HL7 feature in EI.


[1] - https://docs.wso2.com/display/Carbon440/Installing+Features+using+pom+Files

Tuesday, March 7, 2017

Resolving SSL related issue in WSO2 products for MySql 5.7 upward

If you try to start aWSO2 product with Mysql 5.7 it will give the following warning and the product will not work.

Wed Dec 09 22:46:52 CET 2015 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.


This can be avoided for development purposes by not using SSL. For this the JDBC url for the database should be appended with "useSSL=false". But it cannot be appended with a & sign like in a normal URL. Use the following format. If not it may give xml parsing errors.


Then it will work as usual.

Friday, February 12, 2016

BPMN REST tasks with WSO2 BPS

WSO2 BPS supports invoking rest endpoints out of the box. Follow the following steps to add a RESTTask to your workflow using Activity BPMN 2.0 designer.

  1. Add the BPMN designer to your Eclipse installation using the update site here. 
  2. Start a new BPMN project.
  3. Add a new service task from the tasks palette.
  4. Go to the task properties panel and open main config tab.
  5. Select "Java class" as task type.
  6. Give "org.wso2.carbon.bpmn.extensions.rest.RESTTask" as the Class name.
  7. Now add fields with following names, and values in String value field, under documentation section.
    • serviceURL - rest service endpoint
    • method - http method to use
    • basicAuthUsername - username if the endpoints are secured
    • basicAuthPassword - password for the username above
    • input - payload to be sent
    • outputVariable - process variable to save the response
    • headers - header values in the format "key1:value1,key2:value2"
Now you can retrieve the response from the variable specified above in the succession steps of the workflow.

Refer the screenshot below to find out the important places you require inside eclipse designer.


Changing the endpoint after process deployment

The REST endpoint could not change after deploying the process in above method. If you want to change the endpoint after deploying the process also, pointing to a registry location which contains an endpoint reference as mentioned in Endpoint+References. For this add a field with name "serviceRef" instead of the "serviceURL" field and give the registry location of the service reference as the value.

Using json payloads

You can send json as the payload also.

Give the json payload to the input field. This time use the expression box in add field dialog to give the json value instead of string value box. Add new field called "outputMappings" and mention the mapping format from response json, similar to "var2:customer.name,var3:item.price" format.

EDIT on 14/05/2016

REST task sample

I have added a sample at BPMNRESTSample. This sample  make a REST call to a mocky.io endpoint and display the response in a user task. Deploy the sample in WSO2 BPS and start a new process instance from BPMN Explorer shipped with BPS.

Enjoy with REST!!



WSO2 BPS - Customizing web apps

Wso2 BPS 3.5.0 is shipped with two web applications, the Humantask Explorer and BPMN Explorer.
By default it is configured to be used in a standalone BPS server. But they can be configured to other setups also. For this, you need to edit the config.json file. The web apps are located in the <Wso2Server_Home>/repository/deployments/server/jaggeryApps/ folder. I'll refer this as jaggery apps folder, now on. config.json is inside the <webapp_home>/configs folder.

Now, let me explain different configurations one by one.

  1. Use the explorers in a different tenant domain other than the super tenant.
    • Copy the relevant web app from jaggery apps folder into to the <WSO2_Home>/repository/tenants/<tenanat_id>/jaggeryapps folder.
    • Give the tenant name in the config.json.
  2. Run BPS in a separate server other than the web app container.
    • Fill the bpsHost and bpsPort parameters in the config.json
These are the only two configurations I can remember write now. There could me more!



Tuesday, September 29, 2015

Human Tasks : Assign both users and groups in a single people assignment

Usual method of people assignment in WS Human tasks is using a logical people group. But it is not possible to assign to both people groups and users in a single logical people group. So in order to achieve this, you need to use literals as defined in WS Human Task Spec.

Following is a sample of assigning both groups and individuals inside same people assignment to potential owners. I have used and tested this in latest WSO2 Business Process Server successfully.