Showing posts with label SOA. Show all posts
Showing posts with label SOA. Show all posts

Friday, March 15, 2013

Installing Moab Web Services on a Unix box

1) Install Tomcat
yum install tomcat6
2) Install 64-bit version of Oracle Java SE6 JRE.
sh jre-6u37-linux-x64-rpm.bin
rm -f /usr/bin/java
ln -s /etc/alternatives/java /usr/bin/java
alternatives --install /usr/bin/java java /usr/java/jre1.6.0_37/bin/java 500
alternatives --set java /usr/java/jre1.6.0_37/bin/java
3) Create mws home directories and sub-directories
mkdir -p /opt/mws/etc /opt/mws/hooks /opt/mws/plugins /opt/mws/log
chown -R tomcat:tomcat /opt/mws # Depending on your OS, the Tomcat username might be
tomcat6.
chmod -R 555 /opt/mws
chmod u+w /opt/mws/plugins /opt/mws/log
4) Extract mws tarball to a tempory directory.
mkdir /tmp/mws-install
cd /tmp/mws-install
tar xvzf $HOME/Downloads/mws-.tar.gz
cd /tmp/mws-install/mws-
5) Set up the MWS configuration file.
 i) In the extracted MWS directory are two sample configuration files:
   mws-config-cloud.groovy and mws-config-hpc.groovy
   mws-config-cloud.groovy provides sample configuration for the Moab Cloud Suite
   mws-config-hpc.groovy provides sample configuration for the Moab HPC Suites

ii) Choose the correct file for your suite, rename it to mws-config.groovy, and copy it to /opt/mws/etc.

iii) Give the Tomcat user read access to /opt/mws/etc/mws-config.groovy. 6) Add the following line to the end of /etc/tomcat6/tomcat6.conf.
CATALINA_OPTS="-DMWS_HOME=/opt/mws -Xms256m -Xmx3g -XX:MaxPermSize=384m"
7) Start Tomcat and deploy mws.war.
chkconfig tomcat6 on
service tomcat6 stop
cp /tmp/mws-install/mws-/mws.war /var/lib/tomcat6/webapps
service tomcat6 start
8) Visit http://localhost:8080/mws/ in a web browser to verify that MWS is running. You will see some sample queries and a few other actions.

9) Log into MWS to verify that the MWS credentials are working. The credentials are the values of auth.defaultUser.username and auth.defaultUser.password that you set above.

Saturday, February 19, 2011

Handling a http-get request and invoking an external Web service with WSO2 ESB

Following post will discuss how to handle a http-get request from WSO2 ESB and call a external web service. Inorder to clarify example clearly I am using a simple usecase described below. The relevant configuration files, steps to run the sample and the messages flowing through the system is shown below. I have labeled the messages in the diagram, inorder to show the contents of the messages.

Usecase
1. 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.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: 127.0.0.1:8281
Accept: */*
Request-B
POST /services/SimpleStockQuoteService HTTP/1.1
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
Response-C
HTTP/1.1 200 OK
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
Response-D
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:

* 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>
References
[1] - http://wso2.org/downloads/esb
[2] - http://wso2.org/project/esb/java/3.0.1/docs/

Wednesday, January 5, 2011

SFTP file transer with WSO2 ESB.

The VFS transport implementation is based on Apache Commons VFS implementation. VFS (Virtual File System) transport implementation is a module which belongs to the Apache Synapse project. It has a set of service level parameters that needs to be specified for each service.

VFS service level parameters and their descriptions can be found in [1] and the endpoint formats can be found in [2].

Following is a sftp sample for ESB 3.0.1. It copies a file from one sftp location to another sftp folder. SFTPVFSProxy is the proxy service which copies file from one sftp location to another.

If you need further information or need help troubleshooting this sample refer [5].

<proxy name="SFTPVFSProxy" transports="vfs" startOnLoad="true" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="full"/>
<property name="File" expression="fn:concat('test-', get-property('transport', 'FILE_PATH'))" scope="default"/>
<property name="transport.vfs.ReplyFileName" expression="fn:concat(fn:substring-after(get-property('MessageID'), 'urn:uuid:'), '.xml')" scope="transport"/>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint name="endpoint_urn_uuid_A1546EFFD75FC9CCED785986339425964585275">
<address uri="vfs:sftp://heshan:password@10.101.1.112/home/heshan/out"/>
</endpoint>
</send>
</inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:sftp://heshan:password@10.101.1.112/home/heshan/original</parameter>
<parameter name="transport.vfs.FileURI">vfs:sftp://heshan:password@10.101.1.112/home/heshan/in/test.xml</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:sftp://heshan:password@10.101.1.112/home/heshan/original</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>
Following is the XML file (test.xml) that is being moved.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<soapenv:Body>
<getQuote xmlns="http://services.samples">
<request>
<symbol>IBM</symbol>
</request>
</getQuote>
</soapenv:Body>
</soapenv:Envelope>

If you are interested in trying out more VFS samples, refer [3] and [4].

Tuesday, November 23, 2010

Debug Carbon server when it is started as a daemon

WSO2 Carbon Server can be run as a daemon on Unix/Linux systems. Say for instance that you need to remote debug the server when it is started as a daemon. This blogpost will be discussing $subject.

1) Open up the wrapper.conf file.

heshan@heshan-ThinkPad:~/Dev/customer/wso2esb-3.0.1/bin$ vim ../repository/conf/wrapper.conf

2) Add following entries to the wrapper.conf.

wrapper.java.additional.20=-Xdebug
wrapper.java.additional.21=-Xnoagent
wrapper.java.additional.22=-Djava.compiler=NONE
wrapper.java.additional.23=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

3) Start the ESB as a daemon.

heshan@heshan-ThinkPad:~/Dev/customer/wso2esb-3.0.1/bin$ ./wso2server.sh start
Starting WSO2 ESB v3.0.1...

4) Start the debugger.

5) Monitor the log.

heshan@heshan-ThinkPad:~/Dev/customer/wso2esb-3.0.1/bin$ tail -f ../repository/logs/wrapper.log
INFO | jvm 1 | 2010/11/24 11:35:09 | object space 84224K, 76% used [0x00007fbfcff20000,0x00007fbfd3e0dff0,0x00007fbfd5160000)
STATUS | wrapper | 2010/11/24 11:35:09 | <-- Wrapper Stopped STATUS | wrapper | 2010/11/24 11:45:46 | --> Wrapper Started as Daemon
WARN | wrapper | 2010/11/24 11:45:46 | ------------------------------------------------------------------------
WARN | wrapper | 2010/11/24 11:45:46 | The JVM is being launched with a debugger enabled and could possibly be
WARN | wrapper | 2010/11/24 11:45:46 | suspended. To avoid unwanted shutdowns, timeouts will be disabled,
WARN | wrapper | 2010/11/24 11:45:46 | removing the ability to detect and restart frozen JVMs.
WARN | wrapper | 2010/11/24 11:45:46 | ------------------------------------------------------------------------
STATUS | wrapper | 2010/11/24 11:45:46 | Launching a JVM...
INFO | jvm 1 | 2010/11/24 11:45:46 | Listening for transport dt_socket at address: 5005
INFO | jvm 1 | 2010/11/24 11:45:56 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO | jvm 1 | 2010/11/24 11:45:56 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
INFO | jvm 1 | 2010/11/24 11:45:56 |
INFO | jvm 1 | 2010/11/24 11:45:56 | [2010-11-24 11:45:56,845] INFO - Main Initializing system...

Now you have successfully debugged the Carbon Server, when it is started as a daemon.

Thursday, September 9, 2010

WSO2 Enterprise Service Bus (ESB) 3.0.1 Released

The WSO2 ESB team is pleased to announce the release of version 3.0.1 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 3.0.1 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/esb and give it a try.

How to Run

  1. Extract the downloaded zip
  2. Go to the bin directory in the extracted folder
  3. Run the wso2server.sh or wso2server.bat as appropriate
  4. Point your browser to the URL https://localhost:9443/carbon
  5. Use "admin", "admin" as the username and password to login as an admin and create a user account
  6. Assign the required permissions to the user through a role
  7. 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
  8. 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)

New Features of WSO2 ESB 3.0.1

There are no new features in this release. This is a bug fix release. See the section "Bugs Fixed in WSO2 ESB 3.0.1" for more information.

Key Features of WSO2 ESB

  • 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 ultrafast execution and support for thousands of connections at high concurreny 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

Bugs Fixed in This Release

This release of WSO2 ESB comes with a number of bug fixes, both in the base framework and the ESB specific componenents. All the issues which have been fixed in ESB 3.0.1 are recorded at following locations:

Known Issues

  • Endpoint UI does not support selecting already existing endpoints as child endpoints when creating load balance/failover endpoints
  • HTTP GET requests performed on an endpoint that has a trailing '/' character, do not work properly
  • SOAP tracer does not work when the message relay is activated
  • The sequence editor and the built-in XML editors do not work properly on Google Chrome

All the open issues pertaining to WSO2 ESB 3.0 are reported at following locations:

How You Can Contribute

Mailing Lists

Join our mailing list and correspond with the developers directly.

Reporting Issues

WSO2 encourages you to report issues and your enhancement requests for the WSO2 ESB using the public JIRA.

You can also watch how they are resolved, and comment on the progress..

Discussion Forums

Alternatively, questions could be raised using the forums available.

WSO2 ESB Forum : Discussion forum for WSO2 ESB developers/users

Support

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 --

Wednesday, September 1, 2010

WSO2 Con 2010

WSO2 Con 2010 will be held at HNB Towers, Colombo on 14th and 15th September. For more information visit WSO2Con website.


Wednesday, May 19, 2010

SOA Summer School - 2010

Summer School will focus on Service Oriented Architecture (SOA) concepts, technologies, and best practices. In addition to that, this year's Summer School sessions will be including insights into proven techniques for cloud deployments, business process management (BPM), complex event processing (CEP) , business rules processing and more.

Summer School 2010 runs for two months starting 10th June and ending on 29th July. Do you know what's the best news about Summer School is ? IT'S ABSOLUTELY FREE ! :) yes, free as in open source ;)

If you are interested, you can register here.

Sunday, February 21, 2010

WSO2 SOA Workshop NYC

The full-day interactive workshop will show you how to build your own solutions with industry acclaimed best practices and patterns. It will also discuss real SOA deployment issues such as security, interoperability and moving to the Cloud.

Paul Fremantle, Founder and CTO, WSO2 and Asanka Abeysinghe, Lead Solutions Architect will be presenting at the workshop.

For more details and to register visit:
http://wso2.com/events/2010-feb-nyc-soa-workshop/