Skip to main content

WSO2 ESB quick reference - part III

WSO2 ESB uses a set of pre defined properties which can be used to configure the server with heterogeneous integration requirements. This blog post describes some of the most useful properties and their usage.

  • <property name="PRESERVE_WS_ADDRESSING" value="true"/>
By default, the ESB adds a new set of WS-Addressing headers to the messages forwarded from the ESB. If this property is set to "true" on a message, the ESB will forward it without altering its existing WS-Addressing headers.

  • <property name="RESPONSE" value="true"/>
Once this property is set to 'true' on a message, the ESB will start treating it as a response message. It is generally used to route a request message back to its source as the response.

  • <property name="OUT_ONLY" value="true"/>
Set this property to "true" on a message to indicate that no response message is expected for it once it is forwarded from the ESB. In other words, the ESB will do an out-only invocation with such messages. It is very important to set this property on messages that are involved in out-only invocations to prevent the ESB from registering unnecessary callbacks for response handling and eventually running out of memory.

  • <property name="ERROR_CODE" value="100100"/> 
Use this property to set a custom error code on a message which can be later processed by a Synapse fault handler. If the Synapse encounters an error during mediation or routing, this property will be automatically populated.


  • <property name="ERROR_MESSAGE" value="100100"/> 
Use this property to set a custom error message on a message which can be later processed by a Synapse fault handler. If the Synapse encounters an error during mediation or routing, this property will be automatically populated.

  • <property name="messageType" value="text/xml" scope="axis2"/>
Message formatter is selected based on this property. This property should have the content type, for example, text/xml, application/xml.

  • <property name="ContentType" value="text/xml" scope="axis2"/> 
This property will be in effect only if the messageType property is set. If the messageType is set, the value of Content-Type HTTP header of the outgoing request will be chosen based on this property. Note that, this will be dependant on the messageFormatter implementation.

  • <property name="disableAddressingForOutMessages" value="true" scope="axis2"/>
Set this property to "true" if you do not want the ESB to add WS-Addressing headers to outgoing messages. This property can affect messages sent to backend services as well as the responses routed back to clients.

  • <property name="transportNonBlocking" action="remove" scope="axis2" value="true"/>

By default Axis2 will spawn a new thread to handle each outgoing message. To change this behavior remove this property from the message. Removal of this property could be vital when queuing transports like JMS are involved.

  • <property name="INCOMING_TRANSPORT" expression="get-property('TRANSPORT_IN_NAME')"/>
Mediation logic can read incoming transport name using this property (since WSO2 ESB 4.7.0)

  • <property name="POST_TO_URI" scope="axis2" value="true"/>
This property makes the outgoing URL of the ESB a complete URL. This is important when we talk through a Proxy Server.

  • <property name="CONTENT_TYPE" value="text/xml" scope="axis2"/>
In situations, where the ESB is receiving HTTP response messages without the Content-type header, this property can be used to specify a default content type to be used. If no such content type is specified for responses, the ESB will default to application/octet-stream.

  • <property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
This property should be removed if a user want to generate a response from the ESB to a request without an entity body, for example, GET request.

  • <property name="HTTP_SC" value="true" scope="axis2"/>
Set the HTTP status code.

  • <property name="REST_URL_POSTFIX" value="/context" scope="axis2"/>
The value of this property will be appended to the target URL when sending messages out in RESTful manner. Useful when it is required to append a context to the target URL in case of RESTful invocations.

  • $body
The SOAP 1.1 or 1.2 body element. For example, the expression $body/getQuote refers to the first getQuote element in a SOAP body, regardless of whether the message is SOAP-11 or SOAP-12.



  • $Header
The SOAP 1.1 or 1.2 header element. For example, the expression $header/wsa:To refers to the addressing To header regardless of whether this message is SOAP-11 or SOAP-12



  • $axis2

Prefix for Axis2 MessageContext properties. This is used to get the property value at the axis2 scope. For example, to get the value of Axis2 message context property with name REST_URL_POSTFIX, use the XPath expression $axis2:REST_URL_POSTFIX.


  • $ctx

Prefix for Synapse MessageContext properties and gets a property at the default scope. For example, to get the value of Synapse message context property with name ERROR_MESSAGE, use the XPath expression $ctx:ERROR_MESSAGE.


  • $trp

Prefix used to get the transport headers. For example, to get the transport header named Content-Type of the current message, use the XPath expression $trp:Content-Type. HTTP transport headers are not case sensitive. Therefore, $trp:Content-Type and $trp:CONTENT-TYPE are regarded as the same. 

Comments

Popular posts from this blog

WSO2 ESB tuning performance with threads

I have written several blog posts explaining the internal behavior of the ESB and the threads created inside ESB. With this post, I am talking about the effect of threads in the WSO2 ESB and how to tune up threads for optimal performance. You can refer [1] and [2] to understand the threads created within the ESB. [1] http://soatutorials.blogspot.com/2015/05/understanding-threads-created-in-wso2.html [2] http://wso2.com/library/articles/2012/03/importance-performance-wso2-esb-handles-nonobvious/ Within this blog post, I am discussing about the "worker threads" which are used for processing the data within the WSO2 ESB. There are 2 types of worker threads created when you start sending the requests to the server 1) Server Worker/Client Worker Threads 2) Mediator Worker (Synapse-Worker) Threads Server Worker/Client Worker Threads These set of threads will be used to process all the requests/responses coming to the ESB server. ServerWorker Threads will be used to pr

How puppet works in your IT infrstructure

What is Puppet? Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to orchestration and reporting. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud. How the puppet works? It works like this..Puppet agent is a daemon that runs on all the client servers(the servers where you require some configuration, or the servers which are going to be managed using puppet.) All the clients which are to be managed will have puppet agent installed on them, and are called nodes in puppet. Puppet Master: This machine contains all the configuration for different hosts. Puppet master will run as a daemon on this master server. Puppet Agent: This is the daemon that will run on all the servers, which are to be managed using p

How to configure timeouts in WSO2 ESB to get rid of client timeout errors

WSO2 ESB has defined some configuration parameters which controls the timeout of a particular request which is going out of ESB. In a particular  scneario, your client sends a request to ESB, and then ESB sends a request to another endpoint to serve the request. CLIENT->WSO2 ESB->BACKEND The reason for clients getting timeout is that ESB timeout is larger than client's timeout. This can be solved by either increasing the timeout at client side or by decreasing the timeout in ESB side. In any of the case, you can control the timeout in ESB using the below properties. 1) Global timeout defined in synapse.properties (ESB_HOME\repository\conf\) file. This will decide the maximum time that a callback is waiting in the ESB for a response for a particular request. If ESB does not get any response from Back End, it will drop the message and clears out the call back. This is a global level parameter which affects all the endpoints configured in ESB. synapse.global_timeout_inte