Saturday, November 26, 2011

How to read HTTP headers through Synapse Config

You can use the following property mediator to read HTTP headers inside WSO2 ESB through Synapse Configuration.
<property name="Lang" expression="get-property('transport', 'Accept')"/>

Here, the value of the HTTP header called "Accept" get assigned in to property called "Lang"

Thursday, November 24, 2011

How to apply throttling policies through service.xml

You can always apply throttling to services deployed in WSO2 AS using the Management console. But what if you want to apply the throttling policy while the service get deployed. Then you can specify the throttling policy in the service.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: 1.6.1-wso2v1  Built on : Jun 08, 2011 (07:37:38 IST) -->
    <service name="echo">
            <messageReceiver mep="" class="org.wso2.carbon.sample.service.echo.EchoMessageReceiverInOut"/>
        <parameter name="ServiceClass">org.wso2.carbon.sample.service.echo.EchoSkeleton</parameter>
        <parameter name="useOriginalwsdl">true</parameter>
        <parameter name="modifyUserWSDLPortAddress">true</parameter>
        <operation name="echoString" mep="" namespace="">
            <faultActionMapping faultName="echoFault">urn:echoFaultMessage</faultActionMapping>
            <faultActionMapping faultName="EchoFault">urn:echoFaultMessage</faultActionMapping>
            <faultActionMapping faultName="EchoFault_Exception">urn:echoFaultMessage</faultActionMapping>
        <operation name="throwAxisFault" mep="" namespace="">
        <operation name="echoStringArrays" mep="" namespace="">
        <operation name="echoOMElement" mep="" namespace="">
        <operation name="echoInt" mep="" namespace="">
       <module ref="wso2throttle"/>
       <wsp:Policy wsu:Id="WSO2ServiceThrottlingPolicy" xmlns:wsp="" xmlns:wsu="">
      <throttle:ServiceThrottleAssertion xmlns:throttle="">
          <throttle:ID throttle:type="DOMAIN"></throttle:ID>
                <throttle:ProhibitTimePeriod wsp:Optional="true">30000</throttle:ProhibitTimePeriod>
          <throttle:ID throttle:type="DOMAIN">other</throttle:ID>

Tuesday, August 9, 2011

WSO2Con 2011

Architects, Developers, IT Managers and technology enthusiasts, WSO2Con 2011, focuses on you! Newbie or seasoned professional, WSO2Con offers a great week of learning, sharing and the opportunity to connect with experts who have shaped the future enterprise. Register here

Sunday, April 3, 2011

How to hide vertical grid lines in jQuery flot

There is a straight forward method to hide vertical or horizontal grid lines in your jQuery flot bar chart. First of all you need to checkout the flot trunk and include jquery.flot.js and jquery.flot.stack.js scripts in your script. You need the trunk, since released flot - 0.6 does not support this feature.

Then include the following as the options.
xaxis: {
  tickLength: 0

<script id="source">
$(function () {
    var d1 = [];
    for (var i = 0; i <= 10; i += 1)
        d1.push([i, parseInt(Math.random() * 30)]);
    var d2 = [];
    for (var i = 0; i <= 10; i += 1)
        d2.push([i, parseInt(Math.random() * 30)]);
    var d3 = [];
    for (var i = 0; i <= 10; i += 1)
        d3.push([i, parseInt(Math.random() * 30)]);
    var stack = 0, bars = true, lines = false, steps = false;
    function plotWithOptions() {
        $.plot($("#placeholder"), [ d1, d2, d3 ], {
            series: {
                stack: stack,
                lines: { show: lines, steps: steps },
                bars: { show: bars, barWidth: 0.6, align: "center" }
            xaxis: { tickLength: 0}

Friday, March 4, 2011

How to list all svn externals recursively

You can use the following command to list all the svn externals in a directory structure.

svn propget svn:externals -R

Wednesday, March 2, 2011

How to get the transitive dependency list using Maven

You may need to find the list of transitive dependencies, so that you can exclude unnecessary dependencies. Add the following maven plugin


Use dependency:tree as the goal.

mvn clean install dependency:tree

If maven fails with some error, then, use dependency:tree as the goal with -X option.

mvn clean install dependency:tree -X


\- com.hp.hpl.jena:arq:jar:2.8.3:compile
   +- com.hp.hpl.jena:jena:jar:2.6.2:compile
   |  +- org.slf4j:slf4j-log4j12:jar:1.5.6:runtime
   |  \- log4j:log4j:jar:1.2.13:runtime
   +- com.hp.hpl.jena:iri:jar:0.8:compile
   +- org.codehaus.woodstox:wstx-asl:jar:3.2.9:compile
   |  \- stax:stax-api:jar:1.0.1:compile
   +- org.apache.lucene:lucene-core:jar:2.3.1:compile
   +- junit:junit:jar:3.8.1:compile (version managed from 4.5)
   +- org.slf4j:slf4j-api:jar:1.5.8:compile
   \- xerces:xercesImpl:jar:2.7.1:compile

Tuesday, February 8, 2011

How to Deploy WSO2 BPS on JBoss

This article from Pavithra provides step by step directions to deploy WSO2 BPS 2.0.2 in JBoss 5.1.0 GA.
WSO2 BPS can also be installed on other application servers as well. Refer Oxygen Tank for more information.

Monday, February 7, 2011

Orchestration vs Choreography

Service orchestration and service choreography are widely spoken topics when it comes to service composition. Lets take a look at the definitions.


Analogy: Orchestra


The conductor of the orchestra is the one who knows the entire composition. The musicians in the orchestra do not necessarily have to know what other musicians part or what they do. The musicians just have to know how play their instrument in which they best at. The conductor orchestrate the group of musicians to achieve the final output (composition).

Orchestration is the coordination of web services in order to compose the business processes. The business process plays the role of orchestrator/conductor and coordinate the services to fulfill the business process. The individual web services do not aware (it is not necessarily need to know) of the other services involved in the process and the services even do not know that they participate in a business process, they just serve the requests. WS-BPEL specification is an example. WS-BPEL is a language for defining processes that can be executed on an orchestration engine such as WSO2 BPS.


Analogy: Group Dance
Hacettepe University Folk Dances Group

Each and every dancer know, exactly what to do and what other dances will do. They synchronize them selves according to the other dances.  The dancers aware of the each others moves.

Therefore, in choreography, services do not rely on a central coordinator. Each of the service, knows exactly when to execute them selves and when to talk to its peers and sync up. WS-CDL standard is an example.