Tuesday, July 12, 2011
Changing the underlying XSLT processor of WSO2 ESB
Following are the steps to set saxon as the XSLT processor.
1) Remove the xalan-2.7.0.wso2v1.jar from the following locations.
ESB_HOME/lib/xalan-2.7.0.wso2v1.jar
ESB_HOME/lib/endorsed/xalan-2.7.0.wso2v1.jar
2) Then add the Saxon home edition(saxon9he.jar) to the above mentioned locations.
ie.
ESB_HOME/lib/
ESB_HOME/lib/endorsed/
Saxon can be downloaded from [1].
3) Start the ESB server.
After changing the XSLT processor to Saxon, you can do your transformations with the use of Saxon parser.
[1] - http://saxon.sourceforge.net/
Tuesday, June 21, 2011
Local Transport implementation for WSO2 ESB

<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy xmlns="http://ws.apache.org/ns/synapse" name="LocalTransportProxy"
transports="https http" startOnLoad="true" trace="disable">
<target>
<endpoint name="ep1">
<address uri="http://localhost:9000/services/SecondProxy"/>
</endpoint>
<inSequence>
<log level="full"/>
<log level="custom">
<property name="LocalTransportProxy" value="In sequence of LocalTransportProxy invoked!"/>
</log>
</inSequence>
<outSequence>
<log level="custom">
<property name="LocalTransportProxy" value="Out sequence of LocalTransportProxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SecondProxy"
transports="https http" startOnLoad="true" trace="disable">
<target>
<endpoint name="ep2">
<address uri="http://localhost:9000/services/StockQuoteProxy"/>
</endpoint>
<inSequence>
<log level="full"/>
<log level="custom">
<property name="SecondProxy" value="In sequence of Second proxy invoked!"/>
</log>
</inSequence>
<outSequence>
<log level="custom">
<property name="SecondProxy" value="Out sequence of Second proxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy"
startOnLoad="true">
<target>
<endpoint name="ep3">
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<outSequence>
<log level="custom">
<property name="StockQuoteProxy"
value="Out sequence of StockQuote proxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
</definitions>

<definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy xmlns="http://ws.apache.org/ns/synapse" name="LocalTransportProxy"
transports="https http" startOnLoad="true" trace="disable">
<target>
<endpoint name="ep1">
<address uri="local://localhost/services/SecondProxy"/>
</endpoint>
<inSequence>
<log level="full"/>
<log level="custom">
<property name="LocalTransportProxy" value="In sequence of LocalTransportProxy invoked!"/>
</log>
</inSequence>
<outSequence>
<log level="custom">
<property name="LocalTransportProxy" value="Out sequence of LocalTransportProxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SecondProxy"
transports="https http" startOnLoad="true" trace="disable">
<target>
<endpoint name="ep2">
<address uri="local://localhost/services/StockQuoteProxy"/>
</endpoint>
<inSequence>
<log level="full"/>
<log level="custom">
<property name="SecondProxy" value="In sequence of Second proxy invoked!"/>
</log>
</inSequence>
<outSequence>
<log level="custom">
<property name="SecondProxy" value="Out sequence of Second proxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy"
startOnLoad="true">
<target>
<endpoint name="ep3">
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<outSequence>
<log level="custom">
<property name="StockQuoteProxy"
value="Out sequence of StockQuote proxy invoked!"/>
</log>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
</definitions>
Monday, June 13, 2011
WSO2 Enterprise Service Bus 4.0.0 Released
The WSO2 ESB team is pleased to announce the release of version 4.0.0 of the Open Source Enterprise Service Bus (ESB).
WSO2 ESB is a fast, lightweight and user friendly open source Enterprise Service Bus (ESB) distributed under the Apache Software License v2.0. WSO2 ESB allows system administrators and developers to easily configure message routing, intermediation, transformation, logging, task scheduling, fail over routing and load balancing. It also supports transport switching, eventing, rule based mediation and priority based mediation for advanced integration requirements. The ESB runtime is designed to be completely asynchronous, non-blocking and streaming based on the Apache Synapse mediation engine.
WSO2 ESB 4.0.0 is developed on top of the revolutionary WSO2 Carbon platform (Middleware a' la carte), an OSGi based framework that provides seamless modularity to your SOA via componentization. This release also contains many new features and a range of optional components (add-ons) that can be installed to customize the behavior of the ESB. Further, any existing features of the ESB which are not required to your environment can be easily removed using the underlying provisioning framework of Carbon. In brief, WSO2 ESB can be fully customized and tailored to meet your exact SOA needs.
You can download this distribution from http://wso2.org/downloads/esband give it a try.
Brand New Features in this Release
- HTTP relay transport - Pure streaming HTTP transport based on Java NIO for ultra fast HTTP routing
- Deployment synchronizer - Easily synchronize the configuration across a cluster of Carbon Servers
- Message stores and processors - For advanced enterprise messaging and QoS enforcement (eg: in-order delivery, exactly once delivery)
- Mediation templates - The concept of reusable functions to the ESB configuration language
- Message broker - Built-in JMS provider/broker powered by Apache Qpid
- FTPS support via file transport - Transfer files over SSH connections
- Conditional router mediator - Implement advanced and complex routing logic at ease
- URL rewrite mediator - Rewrite URLs and URL fragments efficiently
- Custom XPath extensions - User defined custom XPath extensions support
- New HL7 transport (optional) - Send and receive HL7 messages over MLLP and other transports
- New eventing implementation - A powerful event broker with extensive support for WS-Eventing and topic management
- Event mediator - Publish events to topics defined in the built-in event broker
- LDAP user store - Built-in LDAP service based on Apache Directory Server
- Dynamic registry keys and endpoint URL support - Construct registry lookup keys and endpoint URLs dynamically at mediation time
- Improved Smooks mediator
- Enhanced support for service chaining with the receiving sequence support in the send mediator
- Improved weighted round robin algorithm for the load balance endpoint
- Improvements to caching
- Automatic schema imports from the WSDLs added to the registry (for proxy services)
- Automatic schema imports from the schema files added to the registry (for validate mediator)
- Support for setting properties at the endpoint level
- Enhanced Enrich Mediator
- Improved support for batch transfers in FIX transport
- Validation support for the ESB configuration editor (source view)
- Proxy service UI enhancements
- Enhanced menu layouts
- Local transport for fast in-VM service calls
- Proxy services - facilitating synchronous/asynchronous transport, interface (WSDL/Schema/Policy), message format (SOAP 1.1/1.2, POX/REST, Text, Binary), QoS (WS-Addressing/WS-Security/WS-RM) and optimization switching (MTOM/SwA).
- Non-blocking HTTP/S transports based on Apache HttpCore-NIO for ultra-fast execution and support for thousands of connections at high concurrency with constant memory usage.
- Built in Registry/Repository, facilitating dynamic updating and reloading of the configuration and associated resources (e.g. XSLTs, XSD, WSDL, Policies, JS configurations ..)
- Easily extendable via custom Java classes (mediator and command)/Spring configurations, or BSF Scripting languages (Javascript, Ruby, Groovy, etc.)
- Built in support for scheduling tasks using the Quartz scheduler.
- Load-balancing (with or without sticky sessions)/Fail-over, and clustered Throttling and Caching support
- WS-Security, WS-Reliable Messaging, Caching & Throttling configurable via (message/operation/service level) WS-Policies
- Lightweight, XML and Web services centric messaging model
- Support for industrial standards (Hessian binary web service protocol/ Financial Information eXchange protocol and optional Health Level-7 protocol)
- Enhanced support for the VFS (File/FTP/SFTP), JMS, Mail transports with optional TCP/UDP transports and transport switching among any of the above transports
- Support for message splitting & aggregation using the EIP and service callouts
- Database lookup & store support with DBMediators with reusable database connection pools
- WS-Eventing support with event sources and event brokering
- Rule based mediation of the messages using the Drools rule engine
- Transactions support via the JMS transport and Transaction mediator for database mediators
- Internationalized GUI management console with user management for configuration development
- Integrated monitoring support with statistics, configurable logging and tracing
- JMX monitoring support and JMX management capabilities like, Graceful/Forceful shutdown/restart
This release of WSO2 ESB comes with a number of bug fixes, both in the base framework and the ESB specific components. All the issues which have been fixed in ESB 4.0.0 are recorded at following locations:
All the open issues pertaining to WSO2 ESB 4.0.0 are reported at following locations:
- Extract the downloaded zip
- Go to the bin directory in the extracted folder
- Run the wso2server.sh or wso2server.bat as appropriate
- Point your browser to the URL https://localhost:9443/carbon
- Use "admin", "admin" as the username and password to login as an admin
- If you need to start the OSGi console with the server use the property -DosgiConsole when starting the server. The INSTALL.txt file found on the installation directory will give you a comprehensive set of options and properties that can be passed into the startup script
- Sample configurations can be started by the wso2esb-samples script passing the sample number with the -sn option (Please have a look at the samples guide for more information, on running samples)
How to Contribute
Mailing Lists
Join our mailing list and correspond with the developers directly.
- Developer List : carbon-dev@wso2.org | Subscribe | Mail Archive
- User List : esb-java-user@wso2.org | Subscribe | Mail Archive
We encourage you to report issues, documentation faults and feature requests regarding WSO2 ESB through the public ESB JIRA. You can use the Carbon JIRA to report any issues related to the Carbon base framework or associated Carbon components.
Discussion Forums
Alternatively, questions could be raised using the forums available.
WSO2 ESB Forum: Discussion forum for WSO2 ESB developers/users
We are committed to ensuring that your enterprise middleware deployment is completely supported from evaluation to production. Our unique approach ensures that all support leverages our open development methodology and is provided by the very same engineers who build the technology.
For more details and to take advantage of this unique opportunity please visit http://wso2.com/support.
For more information about WSO2 ESB please see http://wso2.com/products/enterprise-service-bus.
-- The WSO2 ESB Team --
Friday, May 6, 2011
Executing Groovy scripts using WSO2 ESB
1) Download a distribution of the WSO2 ESB [2].
2) Extract the zip file. The directory created will be referred as ESB_HOME.
3) Go to the ESB_HOME/samples/axis2Server/src/SimpleStockQuoteService directory. Run "ant" to build the service. A service archive will be created at ESB_HOME/samples/axis2Server/repository/services. The generated service archive can be deployed at an Axis2 server.
eg. SimpleStockQuoteService.aar
4) Copy the groovy-all-1.1-rc-1.jar into ESB_HOME/repository/components/lib/.
5) Go to the ESB_HOME/bin and run the script which starts wso2server.
eg. wso2server.bat for windows environments
wso2server.sh for linux environments
6) Once the server stats, log into the Mangement Console using following credentials (following are the default username/password).
username: admin
password: admin
7) Add the following proxy to the Synapse configuration using the Source View tab.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="groovyProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">8) Execute the client using the following command.
<target>
<inSequence>
<script language="groovy">println "The current time is: ${new Date()}"</script>
<send>
<endpoint name="endpoint_urn_uuid_4ECE7CA834EC574477533951">
<address uri="http://localhost:9000/services/SimpleStockQuoteService" />
</endpoint>
</send>
</inSequence>
</target>
</proxy>
heshan@heshan-ThinkPad:~/Dev/wso2esb-4.0.0-SNAPSHOT/samples/axis2Client$ ant stockquote -Daddurl=http://localhost:8280/services/groovyProxy9) Following message will be printed at ESB console.
The current time is: Fri May 06 14:00:40 IST 2011References
[1] - http://wso2.org/project/esb/java/3.0.1/docs/mediators/script.html
[2] - http://wso2.org/downloads/esb
Sunday, February 27, 2011
Friendly Basketball Match
When comparing our performance against our previous encounter, our team has improved a lot.
Since we had 2 games in 2 consecutive years, we are planning to take this ahead and have this friendly Basketball match as an annual event.
I should like to thank my junior match mates at Colombo University for coming there to play a match during a University vacation and the crowd for coming there to cheer us.
Saturday, February 19, 2011
Handling a http-get request and invoking an external Web service with WSO2 ESB
Usecase1. Client makes a rest-like http-get: GET /.../company/<id>
eg. curl "http://localhost:8280/services/ProxyA/company/IBM" -v
2. ESB service proxy picks the company id from the url
eg. IBM
3. ESB service makes a web service call to a external ws-service (SimpleStockQuoteService) and a spesific ws-method.
4. ESB service parses the ws-response and returns a plain xml result to the client.
Configuration Files
Following is the Synapse configuration which contains the sample proxy which handles the request.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="ProxyA" transports="https http" startOnLoad="true" trace="disable">
<target>
<inSequence>
<enrich>
<source type="inline">
<a xmlns=""/>
</source>
<target type="body" action="child"/>
</enrich>
<log level="full"/>
<property name="company" expression="substring-after(get-property('To'),'company/')"/>
<xslt key="xslt-transform-request">
<property name="symbol" expression="get-property('company')"/>
</xslt>
<header name="Action" value="urn:getQuote"/>
<log level="full"/>
<send>
<endpoint name="ep1">
<address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<property xmlns:ax21="http://services.samples/xsd" xmlns:ns="http://services.samples" name="response_symbol" expression="//ns:return/ax21:symbol/child::text()"/>
<property xmlns:ax21="http://services.samples/xsd" xmlns:ns="http://services.samples" name="response_high" expression="//ns:return/ax21:high/child::text()"/>
<property xmlns:ax21="http://services.samples/xsd" xmlns:ns="http://services.samples" name="response_low" expression="//ns:return/ax21:low/child::text()"/>
<log level="custom">
<property name="response symbol:" expression="get-property('response_symbol')"/>
<property name="response high :" expression="get-property('response_high')"/>
<property name="response low :" expression="get-property('response_low')"/>
</log>
<xslt key="xslt-transform-response">
<property name="symbol" expression="get-property('response_symbol')"/>
<property name="high" expression="get-property('response_high')"/>
<property name="low" expression="get-property('response_low')"/>
</xslt>
<send/>
</outSequence>
</target>
</proxy>
<localEntry key="xslt-transform-request" src="file:repository/samples/resources/transform/request_transform.xslt"/>
<localEntry key="xslt-transform-response" src="file:repository/samples/resources/transform/response_transform.xslt"/>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' sequence"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
<drop/>
</sequence>
<sequence name="main">
<in>
<log level="full"/>
<filter source="get-property('To')" regex="http://localhost:9000.*">
<send/>
</filter>
</in>
<out>
<send/>
</out>
</sequence>
</definitions>
Following is the xslt transformation (request_transform.xslt) which transforms the request at the ESB.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="symbol"/>
<xsl:template match="/">
<m0:getQuote xmlns:m0="http://services.samples">
<m0:request>
<m0:symbol><xsl:value-of select="$symbol"/></m0:symbol>
</m0:request>
</m0:getQuote>
</xsl:template>
</xsl:stylesheet>
Following is the xslt transformation (response_transform.xslt) which transforms the response at the ESB.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="symbol"/>
<xsl:param name="high"/>
<xsl:param name="low"/>
<xsl:template match="/">
<m0:getQuote xmlns:m0="http://services.samples">
<m0:response>
<m0:company><xsl:value-of select="$symbol"/></m0:company>
<m0:high><xsl:value-of select="$high"/></m0:high>
<m0:low><xsl:value-of select="$low"/></m0:low>
</m0:response>
</m0:getQuote>
</xsl:template>
</xsl:stylesheet>
The contents of the messages flowing through the ESB
Request-A
GET /services/ProxyA/company/IBM HTTP/1.1Request-B
User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
Host: 127.0.0.1:8281
Accept: */*
POST /services/SimpleStockQuoteService HTTP/1.1Response-C
Content-Type: text/xml; charset=UTF-8
Accept: */*
SOAPAction: "urn:getQuote"
Transfer-Encoding: chunked
Host: 127.0.0.1:9001
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO
113
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:envelope soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:body>
<m0:getquote m0="http://services.samples">
<m0:request>
<m0:symbol>IBM</m0:symbol>
</m0:request>
</m0:getQuote>
</soapenv:Body>
</soapenv:Envelope>0
HTTP/1.1 200 OKResponse-D
Content-Type: text/xml; charset=UTF-8
Date: Sat, 19 Feb 2011 08:50:01 GMT
Transfer-Encoding: chunked
Connection: Keep-Alive
40a
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:envelope soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:body>
<ns:getquoteresponse ns="http://services.samples">
<ns:return ax21="http://services.samples/xsd" xsi="http://www.w3.org/2001/XMLSchema-instance" type="ax21:GetQuoteResponse">
<ax21:change>-2.7502820955517455</ax21:change>
<ax21:earnings>13.682776182003703</ax21:earnings>
<ax21:high>159.3075652956029</ax21:high>
<ax21:last>154.1201005301602</ax21:last>
<ax21:lasttradetimestamp>Sat Feb 19 14:20:01 IST 2011</ax21:lastTradeTimestamp>
<ax21:low>158.77156450332262</ax21:low>
<ax21:marketcap>-4211789.232304155</ax21:marketCap>
<ax21:name>IBM Company</ax21:name>
<ax21:open>161.05685744490376</ax21:open>
<ax21:peratio>24.219012038564948</ax21:peRatio>
<ax21:percentagechange>1.913224112346585</ax21:percentageChange>
<ax21:prevclose>-143.75117257844414</ax21:prevClose>
<ax21:symbol>IBM</ax21:symbol>
<ax21:volume>6450</ax21:volume>
</ns:return>
</ns:getQuoteResponse>
</soapenv:Body>
</soapenv:Envelope>0
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Date: Sat, 19 Feb 2011 08:50:01 GMT
Transfer-Encoding: chunked
bc
<m0:getquote m0="http://services.samples">
<m0:response>
<m0:company>IBM</m0:company>
<m0:high>159.3075652956029</m0:high>
<m0:low>158.77156450332262</m0:low>
</m0:response></m0:getQuote>0
Steps to run the sample
1) Download WSO2 ESB [1].
2) Start wso2esb using the startup scripts.
eg: ./wso2server.sh
3) Login to the WSO2 Management console.
4) Copy the attached xslt files (ie. request_transform.xslt, response_transform.xslt) to wso2esb-3.0.1/repository/samples/resources/transform directory.
5) Go to Source View and paste the Synapse configuration to it and hit update.
6) Start the Axis2 server and deploy the SimpleStockQuoteService if not already done.
i) Run the ant script to build the SimpleStockQuoteService. It is residing in wso2esb-3.0.1/samples/axis2Server/src/SimpleStockQuoteService directory.
ii) Then run the simple axis2Server shipped in with the wso2esb. This can be done by the running the axis2Server startup script inside wso2esb-3.0.1/samples/axis2Server/ directory.
eg: ./axis2server.sh
7) Execute the following curl command.
eg: curl "http://localhost:8280/services/ProxyA/company/IBM" -v
Then you will be getting the following response.
eg:
References
* About to connect() to localhost port 8280 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8280 (#0)
> GET /services/ProxyA/company/IBM HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: localhost:8280
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/xml; charset=UTF-8
< Date: Thu, 10 Feb 2011 07:54:46 GMT
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0
<m0:getQuote xmlns:m0="http://services.samples"><m0:response><m0:company>IBM</m0:company><m0:high>-81.16785748190335</m0:high><m0:low>85.09674577550493</m0:low></m0:response></m0:getQuote>
[1] - http://wso2.org/downloads/esb
[2] - http://wso2.org/project/esb/java/3.0.1/docs/