Monday, September 1, 2014

How to perform message transformation in WSO2 ESB


Message type transformations are basically done by both Message Builders and Message Formatters.

Their operation can be depicted on following diagram.



According to this image ... 

  • Message builder is chosen based on the content type of incoming message. The chosen builder processes the incoming message's raw payload and converts it in to soap.
  • Message formatter is chosen based on the content type of outgoing message. It builds the output stream based on the content type of message.


messageType” property can be used to change the content-type of the message.

Now Let us look an example scenario...

#1

I am using the postman chrome plug-in as REST client.




The top part represents the JSON request and the bottom part represents the JSON response from the ESB.


#2

I am using the JAX-RS service as my back end server. You can find the code here.


#3

You can find the synapse configuration with transformation details.



You can further improve this synapse configuration by having switch-case, where you can define various builders or formatters based on the content-type of the incoming or outgoing messages.



How to over come "https not supported or disabled in libcurl" error when using CURL


If you see an error like this, You have to simply follow the following steps.

curl: (1) Protocol https not supported or disabled in libcurl

#1

Uninstall the CURL and its dependencies from your machine

sudo apt-get remove --auto-remove curl


#2

Download the CURL latest version from here.

#3

Navigate to the extracted CURL package and configure it with SSL option.

./configure --with-ssl

#4

now build the source.

make

#5

install the CURL

make install