Posts

Showing posts from 2016

Writing a Custom Message Builder for WSO2 ESB

In WSO2 ESB, when you write a certain mediation logic, a user can do various types of alterations to the message body, headers, etc. Also a user can just passthrough the incoming raw payload without any message processing inside ESB. In situations where the message processing is done, WSO2 ESB uses a universal payload format within ESB. This universal payload format is SOAP message format.

When ESB receives a certain payload, the raw payload is converted to SOAP message format before further processing the content. For this purpose we use Message Builders. Depending on the receiving message's content type, a particular message builder is selected at the run time, for building the message. 
By default bellow Message Builders are available in WSO2 ESB. SOAPBuilderMIMEBuilderMTOMBuilderApplicationXMLBuilderXFormURLEncodedBuilderBinaryRelayBuilderPlainTextBuilder For most of the message content types, these Builders can be used to build the message. If a particular user thinks that they…

Dynamically Selecting SOAP Message Elements in WSO2 ESB

Most recently I faced a requirement where I had to select elements dynamically from a SOAP response message which comes to WSO2 ESB. The use case is as follows.

I have a proxy service where I get a request from a client and let's say the request looks like following.

1: <Request> 2: <Values> 3: <value>2</value> 4: </Values> 5: </Request>
The value can be changed for each request. However when the request is sent to the backend server from ESB we get a response as following

1: <Response> 2: <Events> 3: <Event><TestEntry>Entry Val1</TestEntry></Event> 4: <Event><TestEntry>Entry Val2</TestEntry></Event> 5: <Event><TestEntry>Entry Val3</TestEntry></Event> 6: <Event><TestEntry>Entry Val4</TestEntry></Event> 7: <Event><TestEntry>Entry Val5<…

Working with WSO2 ESB Event Sink and WSO2 DAS

Image
In this post I am going to point out how to integrate WSO2 ESB and WSO2 DAS to send events from ESB to the DAS server. In order to achieve this I am going to use WSO2 ESB v4.9.0 and WSO2 DAS v 3.0.0. In wso2 ESB you can publish events through publish event mediator and event sinks. In order to achieve our task first we need to create an event receiver and an event stream at the DAS end. Also we create an event sink at the ESB end, and use publish event mediator to publish our event to the DAS’s event receiver.
Creating an event stream Log on to DAS server and navigate to streams section as follows.



You can add three types of attributes for the event. Payload data Attributes, Meta Data Attributes and correlation data attributes. In this post I am just using the payload data attributes only. Next persist the event stream.




Creating an Event Receiver Now we need to create an event receiver to receive the events we send from the ESB end. click on the Receivers tab and you will be navigated to t…

Enabling per car file Logging in WSO2 ESB 4.9.0

In WSO2 ESB you can deploy multiple ESB artifact with a car file. In WSO2 ESB 4.9.0 you can get logs identified specially for esb artifacts deployed from a car file. In order to enable this feature you can follow the following steps.


Locate the log4j.properties configuration file at CARBON_HOME/repository/conf directoryComment log4j.appender.CARBON_CONSOLE.layout=org.apache.log4j.PatternLayout entryAdd log4j.appender.CARBON_CONSOLE.layout=org.apache.synapse.AppenderWrapper entry instead
Supported artifact typesMQTT Inbound EndpointsProxy ServicesAPIsSequencesEndpointsInbound EndpointsVfs Inbound EndpointsHttp Inbound EndpointsHttps Inbound endpointsKafka inbound endpointsHL7 Inbound Endpoints