This documentation is for WSO2 Enterprise Integrator version 6.1.0 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »


When a message comes in to WSO2 Enterprise Integrator (WSO2 EI), the receiving transport selects a message builder based on the message's content type. It uses that builder to process the message's raw payload data and convert it into SOAP. Conversely, when sending a message out from WSO2 EI, a message formatter is used to build the outgoing stream from the message. As with message builders, the message formatter is selected based on the message's content type. In a typical WSO2 EI routing scenario, here is the flow:

You can use the messageType property to change the message's content type as it flows through WSO2 EI. For example, if the incoming message is in JSON format and you want to transform it to XML, you could add the messageType property before your mediators in the configuration:

<property name="messageType" value="application/xml" scope="axis2"/>

Configuring message builders and formatters

Message builders and formatters are specified in <EI_HOME>/conf/axis2/axis2.xml under the messageBuilders and messageFormatters configuration sections. WSO2 EI has a few default message builders, so even if you do not specify them explicitly in axis2.xml, they will take effect when messages of those content types come into the WSO2 EI. If you want to use different builders, specify them in axis2.xml to override the defaults. WSO2 EI does not have default message formatters, so it is important to specify all of them in the axis2.xml configuration. Following are the default message builders:

Content typeMessage Builder













Using message relay

If you want to enable message relay, so that messages of a specific content type are not built or formatted but simply pass through WSO2 EI, you can specify the message relay builder (org.wso2.carbon.relay.BinaryRelayBuilder) for that content type. For more information, see Configuring Message Relay.

Handling messages with no content type

To ensure that messages with no content type are handled gracefully without causing errors, add the following to axis2.xml:

  • In the parameters section: <parameter name="defaultContentType" locked="false">empty/content</parameter>
  • In the message builders section: <messageBuilder contentType="empty/content" class="org.wso2.carbon.relay.BinaryRelayBuilder"/> 
  • In the message formatters section: <messageFormatter contentType="empty/content" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>

Handling text/csv messages

There is no default builder or formatter for messages with the text/csv content type. If you just want to pass these messages through WSO2 EI, you can configure the message relay builder and formatter. If you want to process these messages, you can access the content inside the request/response payload of CSV by configuring the org.apache.axis2.format.PlainTextBuilder and org.apache.axis2.format.PlainTextFormatter for the text/csv content type in axis2.xml. For example:

<messagebuilder contenttype="text/csv" class="org.apache.axis2.format.PlainTextBuilder"/>
<messageformatter contenttype="text/csv" class="org.apache.axis2.format.PlainTextFormatter"/>

When a text/csv message comes into WSO2 EI, the log will include an entry similar to the following, and you can observe that the CSV data is placed inside the payload:

[2013-05-09 13:59:03,478] INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:5B9A211341DCC368241368088143463, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:envelope xmlns:soapenv=""><soapenv:body><text xmlns="">charitha,wso2,colombo chamara,wso2G,galle </text></soapenv:body></soapenv:envelope>
  • No labels