Friday, August 11, 2017

Handling FIX session level reject messages in WSO2 ESB

FIX transport implementation  in WSO2 ESB, and  different usages of FIX with integration is discussed in detail in [1]. As much as processing FIX messages it is also important that the integration layer handles any serious FIX errors as well.

FIX  Reject <3> messages are issued when a message is received but cannot be properly processed due to a session-level rule violation. Different reasons for causing session-level rule violations are discussed in [2]. With WSO2 ESB 5.0 we have enhanced FIX implementation for you to acknowledge these session level reject messages and process error handling accordingly. 

You can implement SessionEventHandler (org.apache.synapse.transport.fix.SessionEventHandler)  and direct back specific FIX messages (REJECT<3> messages in this case) back to your proxy. In this case we are updating fromAdmin method to send session level reject messages back to the application, which is the proxy.

public class InitiatorSessionEventHandler implements SessionEventHandler {

public void fromAdmin(FIXIncomingMessageHandler fixIncomingMessageHandler, Message message, SessionID sessionID) {
        //Sending fix 35=3 admin message back to the client.
       try {

           if (message.getHeader().getField(new StringField(35)).getValue().equals("3")) {

               fixIncomingMessageHandler.fromApp(message, sessionID);


Now you just need to add above handler jar to ESB/repository/components/lib and  access these reject messages from your proxy, and do proper error handling.

<filter regex="3" source="//message/header/field[@id='35']">
//error handling 

<parameter name="transport.fix.InitiatorSessionEventHandler">com.wso2.test.InitiatorSessionEventHandler</parameter>

This is just a simple sample on how you can extend SessionEventHandler! You could extend this for any of your session level FIX requirements. And guess what? This is 100% open source! Check out [3] on how WSO2  ESB is 100% open source and how you can benefit from it.


Thursday, August 3, 2017

Powerful capabilities of WSO2 ESB

WSO2 ESB is the one stop shop for your integration requirements.

You need to send a message request of format1 to a back-end that accepts messages of format2? Worried about data format transformations? WSO2 ESB will cover this  for you with  its data transformation capabilities.

You need to send different requests of users to different back-ends? Worried about  how to route these messages? WSO2 ESB will cover this for you ,with its message routing capabilities.

Need to make sure that your service is not available to public and its secured? WSO2 ESB has this covered with its service mediation capabilities.

This is just a glimpse of what WSO2 ESB has in store.. How about data transportation and service hosting? Yes these too are WSO2 ESB capabilities..

Check out written by  Samisa Abeysinghe  (Chief Engineering and Delivery Officer at WSO2) and find out more!

Wednesday, July 5, 2017

Running MSSQL on Mac

 This is a great post on how you can setup mssql in mac with Docker. Once the docker instance is up and running, you can use an sql editor such as DBeaver[2] to execute the sql queries.


Wednesday, June 28, 2017

Common error on securityConfirmation when invoking secured service with .NET client

When invoking a secured SOAP service over a .NET client a very common error as below can be seen.

<Exception> <ExceptionType>System.ServiceModel.Security.MessageSecurityException</ExceptionType> <Message>Signature confirmation is not expected in the security header.</Message> <StackTrace>
This is because the secured policy used for the service is sending a SignatureConfirmation header in its security header.

If you secured the service over WSO2 ESB secured proxy , then you only need to remove below tag in blue from your WS-policy for service.


Executing sqls for AS400 objects with WSO2 ESB

1. Download and add jt400.jar to ESB_HOME/repository/components/lib.
2. Then you could create the connection pool as below and execute your query with dblookup mediator.

               <sql>select id from exp1000 where clId ='A1000000'</sql>
               <result name="custID" column="id"/>

Wednesday, March 1, 2017

Add failed endpoint name and address through fault sequence in WSO2 ESB

When generating custom fault sequence messages, one common use case is when you need to send the endpoint name and endpoint address of the failed endpoint back to the client. This can be done by getting the value of two properties which are 'last_endpoint' and 'ENDPOINT_PREFIX'.

However you can't get 'last_endpoint' property value directly as it sends the endpoint object. Therefore you will have to write a class mediator like below and get the value of that endpoint object and set it to a custom property that you have in your fault sequence.

 public boolean mediate(MessageContext mc) {
          // Get 'last_endpoint' property from message context
         AbstractEndpoint failedEP =(AbstractEndpoint)mc.getProperty("last_endpoint");
         // Get name of the failed endpoint
         String failedEPName =  failedEP.getName();
         // Set value to the endpoint name holder in proxy
         mc.setProperty("default_ep", failedEPName);
            return true;

Now you can create your fault sequence like below.

         <property name="default_ep" value="default"/>
         <class name="org.test.EPMediator"/>
         <payloadFactory media-type="xml">
               <tp:fault xmlns:tp="">
                  <tp:message>Error connecting to the backend</tp:message>
                  <tp:description>Endpoint $1 with address $2 failed!</tp:description>
               <arg evaluator="xml" expression="get-property('default_ep')"/>
               <arg evaluator="xml" expression="get-property('ENDPOINT_PREFIX')"/>

Wednesday, February 15, 2017

Firefox issue with javascript functions directly called on tags

If you try adding a javascript method on a html link like below, You will run into issues when trying out in firefox.

<a href="javascript:functionA();" />

This is because if this functionA returns some value (true/false) other than undefined, it will be appended to the link as a string value , and will try to be rendered which will redirect you to a blank page. Therefore it is always better to add a js function like below.

<a href="#" onclick="functionA();"/>