<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7771139035631272063</id><updated>2012-02-07T01:04:13.272-08:00</updated><title type='text'>Amila's Blogs</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-4388134213281231724</id><published>2010-04-16T23:53:00.000-07:00</published><updated>2010-04-16T23:54:06.338-07:00</updated><title type='text'>Java Security Model</title><content type='html'>An OS process runs under the privileges of the user who fork the process. Therefore under normal conditions a java applications also runs under the privileges of the user who starts it. But there are situations where some privileges of the person who starts it should not be granted to the java application and only set of java code should give the privilege access. &lt;br /&gt;Java security model provides a solution for this problem. It let users to specify a set of granted permissions and act as a additional security layer between java application and OS allowing only granted permissions. &lt;br /&gt;To understand the concepts lets use the following sample program which creates the file test/test.txt.&lt;br /&gt;public class CreateFile {&lt;br /&gt;    public void createFile(){&lt;br /&gt;        File file = new File("test/test.txt");&lt;br /&gt;        try {&lt;br /&gt;            System.out.println("Creating file ==&gt; " + file.getAbsolutePath());&lt;br /&gt;            file.createNewFile();&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;           e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        new CreateFile().createFile();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;Now lets run the program with the following command as a normal user&lt;br /&gt;java -classpath classes/ com.test.security.CreateFile&lt;br /&gt;&lt;br /&gt;This would create the file without any problem in the test directory. Here we ran this program without the security manager. Now lets try to run this program as super user but with the security manager.&lt;br /&gt;&lt;br /&gt;java -Djava.security.manager -classpath classes/ com.test.security.CreateFile&lt;br /&gt;Exception in thread "main" java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read) &lt;br /&gt;        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264) &lt;br /&gt;        at java.security.AccessController.checkPermission(AccessController.java:427) &lt;br /&gt;        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) &lt;br /&gt;        at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1285) &lt;br /&gt;        at java.lang.System.getProperty(System.java:628) &lt;br /&gt;        at java.io.UnixFileSystem.resolve(UnixFileSystem.java:118) &lt;br /&gt;        at java.io.File.getAbsolutePath(File.java:473) &lt;br /&gt;        at com.test.security.CreateFile.createFile(CreateFile.java:27) &lt;br /&gt;        at com.test.security.CreateFile.main(CreateFile.java:35) &lt;br /&gt;&lt;br /&gt;So Even this simple operation runs as the super user it is not allowed to create the file. When a program runs under the security manager it only exposes the security permissions allowed in the security policy files. This is similar to Linux Capabilities. In this way only the required security permission can be given even the program has to started as super users.&lt;br /&gt;Now lets give the necessary permissions to run this program. &lt;br /&gt;First lets create the policy file as follows&lt;br /&gt;grant {&lt;br /&gt;   permission java.util.PropertyPermission "user.dir", "read";&lt;br /&gt;   permission java.io.FilePermission "test/test.txt", "write";&lt;br /&gt; };&lt;br /&gt;&lt;br /&gt;And now run this program as follows,&lt;br /&gt;java -Djava.security.manager -Djava.security.policy=policy/sample.policy -classpath classes/ com.test.security.CreateFile&lt;br /&gt;&lt;br /&gt;Here the -Djava.security.policy is used to specify the policy file location. Now again file is created successfully.&lt;br /&gt;&lt;br /&gt;To understand what happens exactly lets implements our own security permission. Here we write a watch tv permission.&lt;br /&gt;public class TVPermission extends BasicPermission {&lt;br /&gt;    public TVPermission(String name) {&lt;br /&gt;        super(name);&lt;br /&gt;    }&lt;br /&gt;    public TVPermission(String name, String actions) {&lt;br /&gt;        super(name, actions);&lt;br /&gt;    }&lt;br /&gt;    public boolean implies(Permission p) {&lt;br /&gt;        boolean isPermitted = false;&lt;br /&gt;        if (p instanceof TVPermission){&lt;br /&gt;            isPermitted = p.getName().equals(getName())&lt;br /&gt;                    &amp;&amp; p.getActions().equals(getActions());&lt;br /&gt;        }&lt;br /&gt;        return isPermitted;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Any java permission should implements the java.security.Permission interface. Implies is the important method. Actually when someone requests a permission normally java creates a permission object for that object and check for the permission. Lets use this code to check this. &lt;br /&gt;&lt;br /&gt;public class WatchTV {&lt;br /&gt;    public void watchTV() {&lt;br /&gt;        TVPermission tvPermission = new TVPermission("chanel-5", "watch");&lt;br /&gt;        AccessController.checkPermission(tvPermission);&lt;br /&gt;        // other code goes here&lt;br /&gt;    }&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        new WatchTV().watchTV();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now run this program with the following command&lt;br /&gt;It gives this exception&lt;br /&gt;Exception in thread "main" java.security.AccessControlException: access denied (com.test.permission.TVPermission chanel-5) &lt;br /&gt;        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264) &lt;br /&gt;        at java.security.AccessController.checkPermission(AccessController.java:427) &lt;br /&gt;        at com.test.security.WatchTV.watchTV(WatchTV.java:27) &lt;br /&gt;        at com.test.security.WatchTV.main(WatchTV.java:32)&lt;br /&gt;&lt;br /&gt;Now lets add this permission to the policy file as follows and run with the policy file.&lt;br /&gt;grant {&lt;br /&gt;   permission java.util.PropertyPermission "user.dir", "read";&lt;br /&gt;   permission java.io.FilePermission "test/test.txt", "write";&lt;br /&gt;   permission com.test.permission.TVPermission "chanel-5", "watch";&lt;br /&gt; };&lt;br /&gt;&lt;br /&gt; java -Djava.security.manager -Djava.security.policy=policy/sample.policy -classpath classes/ com.test.security.WatchTV&lt;br /&gt;&lt;br /&gt;Now it executes correctly. Now we can understand how java runtime manage permissions under a security manager. &lt;br /&gt;Lets see how actually jdk 1.5 implements the createNewFile method.&lt;br /&gt;&lt;br /&gt;public boolean createNewFile() throws IOException {&lt;br /&gt; SecurityManager security = System.getSecurityManager();&lt;br /&gt; if (security != null) security.checkWrite(path);&lt;br /&gt; return fs.createFileExclusively(path);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;First it gets the Security manager and if it is not null (i.e when running under security manager) check for the write permission. This checkWrite method is like this,&lt;br /&gt;public void checkWrite(String file) {&lt;br /&gt; checkPermission(new FilePermission(file, &lt;br /&gt;     SecurityConstants.FILE_WRITE_ACTION));&lt;br /&gt;    }&lt;br /&gt;public void checkPermission(Permission perm) {&lt;br /&gt; java.security.AccessController.checkPermission(perm);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;This finally calls the AccessController as in earlier sample.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-4388134213281231724?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/4388134213281231724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=4388134213281231724' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/4388134213281231724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/4388134213281231724'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/04/java-security-model.html' title='Java Security Model'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-4563395598801336724</id><published>2010-03-09T03:31:00.001-08:00</published><updated>2010-03-09T03:31:34.872-08:00</updated><title type='text'>Axis2 temp files</title><content type='html'>Axis2 supports archive based deployment for both services (.aar) and modules (.mar). These files can internally have 'lib' folders to contain the third party libraries of those services. &lt;br /&gt;From Axis2 1.5, when Axis2 creates Configuration Context object which happens when the server starts up or service client invocation, it creates a separate folder under the temp folder to store the temp files. This temp folder is taken from the "java.io.tmpdir" system property. &lt;br /&gt;For an example if Axis2 1.5 is deployed under tomcat 6.0.24, it creates the following two files under $CATALINA_TMPDIR.&lt;br /&gt;axis2-tmp-2165190954418103759.tmp  &lt;br /&gt;axis2-tmp-2165190954418103759.tmp.lck&lt;br /&gt;&lt;br /&gt;Axis2 creates .lck files as a temp file which deletes on a jvm exits. &lt;br /&gt;&lt;br /&gt;File lockFile = new File(tmpDirName, tmpDir.getName() + ".lck");&lt;br /&gt;lockFile.createNewFile();&lt;br /&gt;lockFile.deleteOnExit();&lt;br /&gt;&lt;br /&gt;Therefore when the tomcat goes down this .lck file should also be deleted. But the .tmp folder remains. At the next start up time Axis2 searches for .tmp file folders which does not have a corresponding .lck files and deletes them. So there can not be any grow of temp files.&lt;br /&gt;&lt;br /&gt;One important thing to remember is that Axis2 copies the repository files (.aar and .mar) when ever it creates a configuration context object. Therefore the tmp folder can be grown while in the server running. Obviously this can be stopped by using one configuration context object for all the service invocations.&lt;br /&gt;&lt;br /&gt;But there are some instances where .lck file is not properly deleted when the jvm exits. For those situations the temp folder can be deleted within the server starts up shell script. For tomcat this can be done adding code to catalina.sh.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-4563395598801336724?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/4563395598801336724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=4563395598801336724' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/4563395598801336724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/4563395598801336724'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/03/axis2-temp-files.html' title='Axis2 temp files'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-5599241921814591469</id><published>2010-03-08T03:22:00.000-08:00</published><updated>2010-03-08T03:34:11.505-08:00</updated><title type='text'>Queued Transaction processing with WS-RM</title><content type='html'>Couple of years ago I started writing a new WS-RM implementation called Mercury which uses an state machine model to handle the reliability. It was working well for the requirements we had at that time and we have done two releases under the name WSO2 Mercury. But however WSO2 Mercury could not support the user initiated transactions due to a limitation of its storage design. Then that project didn't last too long and WSO2 moved to use Apache Sandesha as its WS-RM implementation for newly developed carbon based products. &lt;br /&gt;At that time I was doing my Msc at University of Moratuwa. For my Msc I was looking for an idea and Dr Sanjiva Weerawarana and Mr Paul Fremantle gave me the idea of re engineering the WSO2 mercury code to support transactions by introducing a new transaction based storage API. Then I started researching different types of reliable message delivery models and finally was able to developed a WS-RM protocol which provides application to application reliability using distributed transactions. This model follows a similar pattern as the well known Queued Transaction processing and hence the thesis tile.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Here is the abstract of my Msc Thesis&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;With the popularity of the distributed business applications, the application data is distributed in various physical storages. However most of the business transactions require to update data stored in more than one storage. Hence updating two data storages reliably is a common problem for most of the distributed business applications. &lt;br /&gt;&lt;br /&gt;Queued transaction processing is a concept widely used to achieve such a processing model using intermediate queues to transfer messages reliably. In such a system at the client side, both updating the client storage and writing the message to be sent to the client side message queue happens in the same distributed transaction. Similarly at the server side reading the message from the server side queue and updating the sever storage happens in the same distributed transaction. But such a system may have interoperability problems if client and server use different types of technologies.&lt;br /&gt;&lt;br /&gt;Web services are used to communicate among the heterogeneous systems by passing SOAP messages using standard transport mechanisms like http. Web services can reliably communicate by using WS-Reliable messaging specification(WS-RM). WS-RM uses concepts of Reliable messaging source (RMS) and Reliable messaging destination (RMD) between which it guarantees reliable message delivery.&lt;br /&gt;&lt;br /&gt;By combining these two concepts, we introduce an approach to solve the above mentioned problem in an interoperable manner using WS-RM to communicate between nodes while keeping RMS and RMD as intermediate storages. In our model reliable message delivery happens in three phases. First both updating application client storage and writing message to the RMS happens in the same distributed transaction. Then WS-RM protocol reliably transfers the message to RMD at the server side. Finally at the server reading the message from the RMD and updating the server storage happens in the same distributed transaction. The middleware software entity that we developed to encapsulate this approach is called Mercury which implements WS-RM protocol.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://people.apache.org/~amilas/msc/Thesis-Amila%20Suriarachchi-088254P.pdf"&gt;Msc Thesis report&lt;/a&gt;&lt;br /&gt;&lt;a href="http://people.apache.org/~amilas/msc/CD.zip"&gt;CD copy which provides the source code, binaries and demos&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-5599241921814591469?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/5599241921814591469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=5599241921814591469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/5599241921814591469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/5599241921814591469'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/03/queued-transaction-processing-with-ws.html' title='Queued Transaction processing with WS-RM'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-1513922313538953861</id><published>2010-02-07T23:01:00.000-08:00</published><updated>2010-02-07T23:05:55.119-08:00</updated><title type='text'>WSO2 WSAS 3.1.3 released</title><content type='html'>WSO2 WSAS is an Enterprise ready web service container based on Apache Axis2 and related other libraries such as Rampart, Sandesha2, Transports etc... Then what is the advantage of using WSO2 WSAS rather than using those apache libraries directly?&lt;br /&gt;&lt;br /&gt;WSO2 WSAS comes with an integrated and tested set of all those libraries so that users do not have to find the compatible libraries and integrate them.&lt;br /&gt;&lt;br /&gt;WSO2 WSAS Admin console provides the extensive monitoring, management features. &lt;br /&gt;The try it can be used to test a web service quickly without generating the stubs. Users can change the log levels through the admin console and can enable request/response message logging in order to check the messages comes in and out.  &lt;br /&gt;Admin Console can be used to update servers while they are running. I.e users can add parameters, engage modules (there are even sample scenarios to engage Security), apply polices, add transports, add services etc .. WSO2 WSAS persists all these changes to its registry so that it is available even if some one restart the server. This is very useful for services that do not uses a services.xml like jaxws servers.&lt;br /&gt;There are some graphical tools called wsdl2java, java2wsdl, WSDL Converter, Try it, Service Validator and Module Validator. &lt;br /&gt;&lt;br /&gt;WSO2 WSAS 3.1.3 can be downloaded &lt;a href="http://wso2.org/downloads/wsas"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-1513922313538953861?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/1513922313538953861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=1513922313538953861' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/1513922313538953861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/1513922313538953861'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/02/wso2-wsas-313-released.html' title='WSO2 WSAS 3.1.3 released'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-2411802756654934865</id><published>2010-01-17T01:08:00.000-08:00</published><updated>2010-01-17T01:12:21.223-08:00</updated><title type='text'>Improving Axis2 http transport client</title><content type='html'>Until Axis2 1.5 a separate http client instance was created per request by default. This leads to an connection timeout problem with the high loads. See &lt;a href="http://amilachinthaka.blogspot.com/2009/05/improving-axis2-client-http-transport.html"&gt;here&lt;/a&gt; for more details.&lt;br /&gt;&lt;br /&gt;In order to solve this issue Axis2 1.5.1 uses one http client object cached in configuration context for all requests. Since by default MultiThreadedHttpConnectionManager allows two request per host this causes an issue if tried to invoke a service more than twice.&lt;br /&gt;&lt;br /&gt;Following options can be taken to solve this issue.&lt;br /&gt;1.set HTTPConstants.AUTO_RELEASE_CONNECTION to true&lt;br /&gt;serviceClient.getOptions().setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, Constants.VALUE_TRUE);&lt;br /&gt;this would build the response stream once the response stream returned and release the connection. But this may have a performance hit since it build the OM tree at transport level.&lt;br /&gt;2.Clean up the transport after each call &lt;br /&gt;serviceClient.cleanupTransport();&lt;br /&gt;&lt;br /&gt;However both the above methods can only invoke two requests at time since there is only two connections. Again this may cause problems with invoking slow services. This can be avoided by the following technique to increase the default number of connections.&lt;br /&gt;&lt;br /&gt;ConfigurationContext configurationContext = &lt;br /&gt;                    ConfigurationContextFactory.createConfigurationContextFromFileSystem( &lt;br /&gt;                            AXIS2_REPOSITORY_LOCATION, AXIS2_CLIENT_CONFIG_FILE); &lt;br /&gt;&lt;br /&gt;            MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new MultiThreadedHttpConnectionManager(); &lt;br /&gt;&lt;br /&gt;            HttpConnectionManagerParams params = new HttpConnectionManagerParams(); &lt;br /&gt;            params.setDefaultMaxConnectionsPerHost(20); &lt;br /&gt;            multiThreadedHttpConnectionManager.setParams(params); &lt;br /&gt;            HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager); &lt;br /&gt;            configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); &lt;br /&gt;&lt;br /&gt;and call serviceClient.cleanupTransport(); after each service invocation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-2411802756654934865?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/2411802756654934865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=2411802756654934865' title='42 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2411802756654934865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2411802756654934865'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/01/improving-axis2-http-transport-client.html' title='Improving Axis2 http transport client'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>42</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-8012914126518112756</id><published>2010-01-15T23:10:00.000-08:00</published><updated>2010-01-15T23:21:17.464-08:00</updated><title type='text'>Changing Axis2 application path</title><content type='html'>By default Axis2 generates an context path as follows when deployed it in tomcat or other application server.&lt;br /&gt;&lt;br /&gt;http://localhost:8080/axis2/services/Version?wsdl&lt;br /&gt;&lt;br /&gt;but most of the it is requried to customize this as follows.&lt;br /&gt;&lt;br /&gt;http://localhost:8080/myApp/myServices/Version?wsdl&lt;br /&gt;&lt;br /&gt;Below steps can be used to achive this.&lt;br /&gt;1. Rename the web app name axis2 to myApp&lt;br /&gt;2. Uncomment and edit the servicePath parameter at the axis2.xml file&lt;br /&gt;&lt;parameter name="servicePath"&gt;myServices&lt;/parameter&gt;&lt;br /&gt;3. Add the following entry to web.xml. Here we need to add this entry rather than chaing existing one since services part is hard coded in some places.&lt;br /&gt;&lt;br /&gt;   &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;        &amp;lt;servlet-name&amp;gt;AxisServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;        &amp;lt;url-pattern&amp;gt;/myServices/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;   &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;How to get a path like this?&lt;br /&gt;&lt;br /&gt;http://localhost:8080/myServices/Version?wsdl&lt;br /&gt;&lt;br /&gt;This can be done my making this application as ROOT app&lt;br /&gt;1. change the myApp to ROOT&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-8012914126518112756?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/8012914126518112756/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=8012914126518112756' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/8012914126518112756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/8012914126518112756'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/01/changing-axis2-application-path.html' title='Changing Axis2 application path'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-2090537734650813509</id><published>2010-01-07T03:37:00.000-08:00</published><updated>2010-01-07T03:45:13.449-08:00</updated><title type='text'>WSO2 Data Services v2.2.0 released</title><content type='html'>Axis2 lets users to develop web services from the java code. This can either be a POJO where users write the business logic first or a generated code with the WSDL. In whatever form real business logic retrieve data from the data store (most of the time a database) and update it.&lt;br /&gt;&lt;br /&gt;Therefore isn't it useful to publish the data stored in permanent storage straight away (I.e using some descriptor files) without doing any coding? &lt;a href="http://wso2.org/projects/data-services-server/java"&gt;WSO2 Data services server&lt;/a&gt; let users to publish data by just writing a descriptor file. Currently it can publish data stored in many forms. eg. Databases, text files, excel sheets, google docs etc..&lt;br /&gt;Since &lt;a href="http://wso2.org/projects/data-services-server/java"&gt;WSO2 Data services server&lt;/a&gt; build on top of WSO2 carbon platform it inherit all the WS* features such as security, reliable messaging, addressing etc ..&lt;br /&gt;&lt;br /&gt;Following are some of the key features:&lt;br /&gt;&lt;br /&gt;- Multiple data source support - any relational database accessible via JDBC, CSV, Excel, JNDI bound data sources and Google Spreadsheets&lt;br /&gt;- Web service and REST interfaces for data&lt;br /&gt;- Customizable response format to match your next adaptor's input&lt;br /&gt;- Support for large data sets with little to no impact to the server's memory usage&lt;br /&gt;- Nested queries and federated response from multiple disparate data sources&lt;br /&gt;- Role based content filtering&lt;br /&gt;- Full support for WS-Security, WS-Trust, WS-Policy, WS-SecureConversation and XKMS&lt;br /&gt;- Web based GUI wizard&lt;br /&gt;- Multi transport support - send and receive your data in either HTTP(s), SMTP, JMS and XMPP&lt;br /&gt;- Reliable delivery of data&lt;br /&gt;- Access throttling based on IP/Domain or frequency&lt;br /&gt;&lt;br /&gt;WSO2 Data Services 2.2.0 can be downloaded from &lt;a href="http://wso2.org/downloads/data-services-server"&gt;http://wso2.org/downloads/data-services-server&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-2090537734650813509?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/2090537734650813509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=2090537734650813509' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2090537734650813509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2090537734650813509'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/01/wso2-data-services-v220-released.html' title='WSO2 Data Services v2.2.0 released'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-5329766925662004385</id><published>2010-01-01T07:44:00.000-08:00</published><updated>2010-01-01T07:48:10.268-08:00</updated><title type='text'>Axis2 Authentication</title><content type='html'>The servlet specification provides four authentication mechanisms for any web application. Therefore any web services engine which receives http requests through a servlet can use those authentication mechanisms. Here is how you can do BASIC and DIGEST authentication with Apache Axis2 deployed under tomcat. &lt;br /&gt;&lt;br /&gt;Axis2 war distribution is a standard web application. This war distribution contains a web.xml and within it there is a servlet called AxisServlet which is used to receive the http requests.&lt;br /&gt;&lt;br /&gt;Configuring the war distribution.&lt;br /&gt;First the following should add to the web.xml file to protect the AxisServlet from the anonymous access.&lt;br /&gt;&lt;br /&gt;&amp;lt;login-config&amp;gt;&lt;br /&gt;    &amp;lt;!--  &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;  --&amp;gt;&lt;br /&gt;    &amp;lt;auth-method&amp;gt;DIGEST&amp;lt;/auth-method&amp;gt;&lt;br /&gt;    &amp;lt;realm-name&amp;gt;default&amp;lt;/realm-name&amp;gt;&lt;br /&gt;&amp;lt;/login-config&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;&amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;    &amp;lt;web-resource-name&amp;gt;Protected Resource&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;    &amp;lt;url-pattern&amp;gt;/services/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;auth-constraint&amp;gt;&lt;br /&gt;    &amp;lt;role-name&amp;gt;tomcat&amp;lt;/role-name&amp;gt;&lt;br /&gt;&amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;&amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;br /&gt;then add the following to the tomcat-users.xml&lt;br /&gt;&lt;user username="tomcat" password="tomcat" roles="tomcat"/&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now the servlet is protected and Lets see how to provide the credentials when accessing the service. This is in fact done by using the functionality available with the commons http client.&lt;br /&gt;&lt;br /&gt;ServiceClient serviceClient = new ServiceClient();&lt;br /&gt;            serviceClient.setTargetEPR(new EndpointReference("http://localhost:8080/axis2/services/Version/getVersion"));&lt;br /&gt;            serviceClient.getOptions().setAction("urn:getVersion");&lt;br /&gt;&lt;br /&gt;            HttpTransportProperties.Authenticator authenticator = new  HttpTransportProperties.Authenticator();&lt;br /&gt;            authenticator.setUsername("tomcat");&lt;br /&gt;            authenticator.setPassword("tomcat");&lt;br /&gt;&lt;br /&gt;            serviceClient.getOptions().setProperty(HTTPConstants.AUTHENTICATE, authenticator);&lt;br /&gt;            serviceClient.sendReceive(null);&lt;br /&gt;  &lt;br /&gt;This request can be send through a tcpmon to understand how this authentication works. First Axis2 client sends a normal request and tomcat server returns an Unauthorized response with the required authentication method.&lt;br /&gt;&lt;br /&gt;HTTP/1.1 401 Unauthorized&lt;br /&gt;&lt;br /&gt;Server: Apache-Coyote/1.1&lt;br /&gt;&lt;br /&gt;WWW-Authenticate: Digest realm="default", qop="auth", nonce="6da725c4d901eee87d2ad49cadbac74a", opaque="37629e27fec9bfaf38063bc3ab65f12d"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After receiving this Axis2 client sends another request with the authentication details.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-5329766925662004385?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/5329766925662004385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=5329766925662004385' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/5329766925662004385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/5329766925662004385'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2010/01/axis2-authentication.html' title='Axis2 Authentication'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-9043597354658246655</id><published>2009-11-30T01:08:00.000-08:00</published><updated>2009-11-30T01:18:44.069-08:00</updated><title type='text'>Minimal jars required for Axis2 1.5</title><content type='html'>Minimal jars required for Axis2 1.5 is slightly different from Axis2 1.4.1.&lt;br /&gt;&lt;br /&gt;Here is a set of jars required with Axis2 1.5 to invoke a service written using Axiom and&lt;br /&gt;to invoke it using direct service client using default axis2.xml file.&lt;br /&gt;&lt;br /&gt;axis2-kernel-1.5.jar&lt;br /&gt;axiom-api-1.2.8.jar&lt;br /&gt;axiom-dom-1.2.8.jar&lt;br /&gt;axiom-impl-1.2.8.jar&lt;br /&gt;commons-logging-1.1.1.jar&lt;br /&gt;wsdl4j-1.6.2.jar&lt;br /&gt;XmlSchema-1.4.3.jar&lt;br /&gt;neethi-2.0.4.jar&lt;br /&gt;axis2-transport-local-1.5.jar&lt;br /&gt;axis2-transport-http-1.5.jar&lt;br /&gt;commons-httpclient-3.1.jar&lt;br /&gt;mail-1.4.jar&lt;br /&gt;commons-fileupload-1.2.jar&lt;br /&gt;woden-api-1.0M8.jar&lt;br /&gt;woden-impl-dom-1.0M8.jar&lt;br /&gt;httpcore-4.0.jar&lt;br /&gt;commons-codec-1.3.jar&lt;br /&gt;geronimo-stax-api_1.0_spec-1.0.1.jar&lt;br /&gt;wstx-asl-3.2.4.jar&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;axis2-jaxws-1.5.jar may be used to avoid some waning messages with the default axis2.xml.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-9043597354658246655?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/9043597354658246655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=9043597354658246655' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/9043597354658246655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/9043597354658246655'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/11/minimal-jars-required-for-axis2-15.html' title='Minimal jars required for Axis2 1.5'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-9083696844622397236</id><published>2009-10-05T06:30:00.001-07:00</published><updated>2009-10-05T06:30:54.036-07:00</updated><title type='text'>Axis2 Class loading</title><content type='html'>Axis2 let users to deploy services and modules as separate archive files. These files can contain normal java classes or .jar files. Therefore at the deployment time Axis2 has to read those java classes and .jar files and create class loaders for services and modules. These are the places it looks for load those classes.&lt;br /&gt;When axis2 deployed as web application using the axis2 war distribution, Axis2 uses the web application class loader (this contains WEB-INF/classes and WEB-INF/lib jars) as the top most parent.&lt;br /&gt;&lt;br /&gt;For service deployment it creates a service class loader using jars under the services/lib (this folder has to create by the users if needed) folder and using web application class loader as the parent.  Then for each service it creates a separate class loader  (which contains archive class files and lib jar files) using the service class loader as the parent.&lt;br /&gt;&lt;br /&gt;Similar thing happens for modules. The module class loader can uses the modules/lib folder to load the jar files and it use as the parent class loader for other modules. This forms the following parent child relationship for class loaders.&lt;br /&gt;&lt;br /&gt;          Web class loader&lt;br /&gt;        services class loader           modules class loader&lt;br /&gt;   other service class loaders      other service class loaders&lt;br /&gt;&lt;br /&gt;Child First (parent last) class loading&lt;br /&gt;By default Axis2 uses the parent first class loading. Child first class loading can be switch by setting  EnableChildFirstClassLoading parameter.&lt;br /&gt;&amp;lt;parameter name="EnableChildFirstClassLoading"&amp;gt;true&amp;lt;/parameter&amp;gt;&lt;br /&gt;&lt;br /&gt;Thread Context class loading&lt;br /&gt;Some libraries uses the Thread context class loading. By default axis2 sets the service class loader as the thread context class loader before invoking a service. This can be changed by setting the context class loader to composite.&lt;br /&gt;&lt;br /&gt;I.e adding this parameter to service&lt;br /&gt;&amp;lt;parameter name="ServiceTCCL"&amp;gt;composite&amp;lt;/parameter&amp;gt;&lt;br /&gt;&lt;br /&gt;when this parameter is set it creates the context class loader by using both existing thread context class loader and service class loader.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-9083696844622397236?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/9083696844622397236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=9083696844622397236' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/9083696844622397236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/9083696844622397236'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/10/axis2-class-loading.html' title='Axis2 Class loading'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-4303594180327231292</id><published>2009-10-01T08:12:00.000-07:00</published><updated>2009-10-01T08:13:08.485-07:00</updated><title type='text'>Axis2 Hierarchical Service Deployment</title><content type='html'>Axis2 has a concept of a service archive (.aar). After introducing the custom deployers even users can deploy different types of files as services. (eg. .class and .jar for jaxws services).&lt;br /&gt;But until recently all those service files had to kept in the services folder or respective other service folders. This may not efficient in managing a lot of services. With the introduction of hierarchical service deployment it is possible to keep the directory structure under the services folder and the folder structure is reflect in the service epr as well.&lt;br /&gt;&lt;br /&gt;eg. one can have services like this.&lt;br /&gt;&lt;br /&gt;./services/interop/rm/EchoStringService.aar&lt;br /&gt;&lt;br /&gt;./services/interop/rm/PingService.aar&lt;br /&gt;./services/version/v1.1/version.aar&lt;br /&gt;&lt;br /&gt;./services/version/v1.2/version.aar&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Epr for the PingService is &lt;br /&gt;http://localhost:8080/axis2/services/interop/rm/PingService&lt;br /&gt;&lt;br /&gt;As seen in the last two lines this feature can be used for version management as well. Different version of the same service can be deployed and Epr is generated accordingly.&lt;br /&gt;&lt;br /&gt;http://localhost:8080/axis2/services/version/v1.2/Version&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-4303594180327231292?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/4303594180327231292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=4303594180327231292' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/4303594180327231292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/4303594180327231292'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/10/axis2-hierarchical-service-deployment.html' title='Axis2 Hierarchical Service Deployment'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-3165377402213479610</id><published>2009-09-30T07:57:00.001-07:00</published><updated>2009-09-30T07:58:13.468-07:00</updated><title type='text'>Inter operating Apache Sandesah2 with WCF</title><content type='html'>Recently I have been working on interoperating WCF with the Apache Sandesha2. The good news is all the plain RM scenarios pass with some small fixings. Here is an sample client which can be used to invoke the wcf services available at http://131.107.72.15/endpoints/&lt;br /&gt;&lt;br /&gt;First I generated the code for the given wsdl with wsdl2java tool with the following arguments&lt;br /&gt;&lt;br /&gt;-uri http://10.100.1.238/ReliableMessaging_Service_WSAddressingAugust2004_Indigo/RequestReply.svc?wsdl&lt;br /&gt;                            -u -ap -uw&lt;br /&gt;&lt;br /&gt;                                    -p org.wso2.carbon.interop.microsoft.rm.requestreply&lt;br /&gt;&lt;br /&gt;                                    -o target/generated-code&lt;br /&gt;&lt;br /&gt;                                    -Emp org.wso2.carbon.interop.microsoft.rm.requestreply&lt;br /&gt;&lt;br /&gt;                                    -ns2p http://tempuri.org/=org.wso2.carbon.interop.microsoft.rm.requestreply,http://schemas.microsoft.com/2003/10/Serialization/=org.wso2.carbon.interop.microsoft.rm.requestreply.types&lt;br /&gt;&lt;br /&gt;Then we can simple invoke the service using the following client code.&lt;br /&gt;&lt;br /&gt;// creating an configuration context which contains sandesah2 and addressing&lt;br /&gt;            ConfigurationContext configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("target" + File.separator +&lt;br /&gt;                    "org.wso2.carbon.interop.microsoft.rm-SNAPSHOT.dir" +&lt;br /&gt;                    File.separator + "repository");&lt;br /&gt;&lt;br /&gt;            EchoStringServiceCustomBinding_IEchoString9Stub stub = new EchoStringServiceCustomBinding_IEchoString9Stub(configurationContext,&lt;br /&gt;                    "http://131.107.72.15/ReliableMessaging_Service_WSAddressingAugust2004_Indigo/RequestReply.svc/Reliable_Anonymous_Soap11_WSAddressingAugust2004_RM11");&lt;br /&gt;            // this is to send messages through tcp mon&lt;br /&gt;            stub._getServiceClient().getOptions().setProperty(Constants.Configuration.TRANSPORT_URL,&lt;br /&gt;                    "http://localhost:8088/ReliableMessaging_Service_WSAddressingAugust2004_Indigo/RequestReply.svc/Reliable_Anonymous_Soap11_WSAddressingAugust2004_RM11");&lt;br /&gt;&lt;br /&gt;            // setting the correct addressing , soap and rm versions&lt;br /&gt;            stub._getServiceClient().getOptions().setProperty(AddressingConstants.WS_ADDRESSING_VERSION, AddressingConstants.Submission.WSA_NAMESPACE);&lt;br /&gt;            stub._getServiceClient().getOptions().setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);&lt;br /&gt;            stub._getServiceClient().getOptions().setProperty(SandeshaClientConstants.RM_SPEC_VERSION, Sandesha2Constants.SPEC_VERSIONS.v1_1);&lt;br /&gt;&lt;br /&gt;            //wcf does not support make connections so disable it&lt;br /&gt;            Parameter sandeshaPolicyBeanParam = stub._getServiceClient().getAxisConfiguration().getParameter(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);&lt;br /&gt;            if (sandeshaPolicyBeanParam != null) {&lt;br /&gt;                SandeshaPolicyBean sandeshaPolicyBean = (SandeshaPolicyBean) sandeshaPolicyBeanParam.getValue();&lt;br /&gt;                sandeshaPolicyBean.setEnableMakeConnection(false);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            stub._getServiceClient().engageModule("addressing");&lt;br /&gt;            stub._getServiceClient().engageModule("sandesha2");&lt;br /&gt;&lt;br /&gt;            PingRequestBodyType pingRequestBodyType = new PingRequestBodyType();&lt;br /&gt;            pingRequestBodyType.setSequence("Sequence 1");&lt;br /&gt;            pingRequestBodyType.setText("testparam");&lt;br /&gt;            PingResponseBodyType pingResponseBodyType = null;&lt;br /&gt;            String responseString = "";&lt;br /&gt;            for (int i = 0; i &lt; 3; i++) {&lt;br /&gt;                responseString += "testparam";&lt;br /&gt;                pingResponseBodyType = stub.echoString(pingRequestBodyType);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // after sending the messages we can close and terminate the sequence&lt;br /&gt;            SandeshaClient.closeSequence(stub._getServiceClient());&lt;br /&gt;            SandeshaClient.terminateSequence(stub._getServiceClient());&lt;br /&gt;&lt;br /&gt;            //wait until terminate sequence messge is send&lt;br /&gt;            SandeshaClient.waitUntilSequenceCompleted(stub._getServiceClient());&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-3165377402213479610?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/3165377402213479610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=3165377402213479610' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3165377402213479610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3165377402213479610'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/09/inter-operating-apache-sandesah2-with.html' title='Inter operating Apache Sandesah2 with WCF'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-3643589194877243545</id><published>2009-09-27T22:40:00.000-07:00</published><updated>2009-09-27T22:48:20.474-07:00</updated><title type='text'>Handling date and dateTime with Axis2</title><content type='html'>With Axis2 1.5 java.util.Date is mapped to xs:date type and java.util.Calendar is mapped to xs:dateTime. For an example if we deployed a POJO service as follows&lt;br /&gt;&lt;br /&gt;public class TestService {&lt;br /&gt;&lt;br /&gt;    public Date getDate() {&lt;br /&gt;        return new Date();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public Calendar getCalendar() {&lt;br /&gt;        return Calendar.getInstance();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This generates an WSDL with schema like this.&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name="getDateResponse"&amp;gt;&lt;br /&gt;    &amp;lt;xs:complexType&amp;gt;&lt;br /&gt;        &amp;lt;xs:sequence&amp;gt;&lt;br /&gt;            &amp;lt;xs:element minOccurs="0" name="return" nillable="true" type="xs:date"/&amp;gt;&lt;br /&gt;        &amp;lt;/xs:sequence&amp;gt;&lt;br /&gt;    &amp;lt;/xs:complexType&amp;gt;&lt;br /&gt;&amp;lt;/xs:element&amp;gt;&lt;br /&gt;&amp;lt;xs:element name="getCalendarResponse"&amp;gt;&lt;br /&gt;&amp;lt;xs:complexType&amp;gt;&lt;br /&gt;    &amp;lt;xs:sequence&amp;gt;&lt;br /&gt;        &amp;lt;xs:element minOccurs="0" name="return" nillable="true" type="xs:dateTime"/&amp;gt;&lt;br /&gt;    &amp;lt;/xs:sequence&amp;gt;&lt;br /&gt;&amp;lt;/xs:complexType&amp;gt;&lt;br /&gt;&amp;lt;/xs:element&amp;gt;&lt;br /&gt;When invoking the service we get the following response xmls&lt;br /&gt;&lt;br /&gt;&amp;lt;ns:getDateResponse xmlns:ns="http://service.lockhead.test"&amp;gt;&amp;lt;ns:return&amp;gt;2009-09-28&amp;lt;/ns:return&amp;gt;&amp;lt;/ns:getDateResponse&amp;gt;&lt;br /&gt;&amp;lt;ns:getCalendarResponse xmlns:ns="http://service.lockhead.test"&amp;gt;&amp;lt;ns:return&amp;gt;2009-09-28T10:55:01.770+05:30&amp;lt;/ns:return&amp;gt;&amp;lt;/ns:getCalendarResponse&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-3643589194877243545?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/3643589194877243545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=3643589194877243545' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3643589194877243545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3643589194877243545'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/09/handling-date-and-datetime-with-axis2.html' title='Handling date and dateTime with Axis2'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-6999626757341901932</id><published>2009-09-24T21:55:00.000-07:00</published><updated>2009-09-24T21:59:39.660-07:00</updated><title type='text'>Sending an arbitrary soap message with Axis2</title><content type='html'>Axis2 code generation strictly follows the WS-I profile which prohibits sending soap messages with two child elements in the soap body. Even normal Service client API allows only one omElement to be send at the soap body.&lt;br /&gt;One work around to send two elements is to use an operation client which allows a user to set whole SoapEnvelope hence sending any arbitrary one.&lt;br /&gt;&lt;br /&gt;            ServiceClient serviceClient = new ServiceClient();&lt;br /&gt;            OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);&lt;br /&gt;            //creating message context&lt;br /&gt;            MessageContext outMsgCtx = new MessageContext();&lt;br /&gt;            Options opts = outMsgCtx.getOptions();&lt;br /&gt;            //setting properties into option&lt;br /&gt;            opts.setTo(new EndpointReference("http://localhost:8088/axis2/services/TestInOutService"));&lt;br /&gt;            opts.setAction("urn:TestInOutService");&lt;br /&gt;&lt;br /&gt;            SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();&lt;br /&gt;            SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();&lt;br /&gt;&lt;br /&gt;            OMElement omElement1 = soapFactory.createOMElement(new QName("http://axis2.test","firstElement"));&lt;br /&gt;            OMElement omElement2 = soapFactory.createOMElement(new QName("http://axis2.test","secondElement"));&lt;br /&gt;&lt;br /&gt;            soapEnvelope.getBody().addChild(omElement1);&lt;br /&gt;            soapEnvelope.getBody().addChild(omElement2);&lt;br /&gt;&lt;br /&gt;            outMsgCtx.setEnvelope(soapEnvelope);&lt;br /&gt;            opClient.addMessageContext(outMsgCtx);&lt;br /&gt;            opClient.execute(true);&lt;br /&gt;&lt;br /&gt;            MessageContext inMsgtCtx = opClient.getMessageContext("In");&lt;br /&gt;&lt;br /&gt;            SOAPEnvelope response = inMsgtCtx.getEnvelope();&lt;br /&gt;            System.out.println(response);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-6999626757341901932?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/6999626757341901932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=6999626757341901932' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/6999626757341901932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/6999626757341901932'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/09/sending-arbitrary-soap-message-with.html' title='Sending an arbitrary soap message with Axis2'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-631500218677096513</id><published>2009-05-20T04:22:00.000-07:00</published><updated>2009-05-20T04:23:39.238-07:00</updated><title type='text'>Axis2 child first class loading</title><content type='html'>With axis2 it is possible to deploy services as service archive files and modules as module archive files. Both these two types of archives can contain .class or .jar files within it. Axis2 creates a separate class loader to load these class and jar files within the archive file.&lt;br /&gt; By default Axis2 uses parent first class loading. This means jvm search for a particular class in parent before search it at the current class loader. As a result of this user could not use a different version of a jar file within their archives. &lt;br /&gt; I recently added the child first class loading support (this is only available with main trunk) so that users can use different versions of class files at their services. &lt;br /&gt;&lt;br /&gt;How to enable it?&lt;br /&gt; This can be globally enable by setting the 'EnableChildFirstClassLoading' parameter to true at the axis2.xml file. Further the behavior of the services or modules can be set adding the same parameter to services.xml and module.xml.&lt;br /&gt;&lt;br /&gt;How it works?&lt;br /&gt;Axis2 uses a custom class loader called DeploymentClassLoader which is extended from the java URLClassloader. URLClassloader uses a parent first approach.  LoadClass method of the java classloader class looks like this,&lt;br /&gt;&lt;br /&gt;protected synchronized Class&lt;?&gt; loadClass(String name, boolean resolve)&lt;br /&gt; throws ClassNotFoundException&lt;br /&gt;    {&lt;br /&gt; // First, check if the class has already been loaded&lt;br /&gt; Class c = findLoadedClass(name);&lt;br /&gt; if (c == null) {&lt;br /&gt;     try {&lt;br /&gt;  if (parent != null) {&lt;br /&gt;      c = parent.loadClass(name, false);&lt;br /&gt;  } else {&lt;br /&gt;      c = findBootstrapClass0(name);&lt;br /&gt;  }&lt;br /&gt;     } catch (ClassNotFoundException e) {&lt;br /&gt;         // If still not found, then invoke findClass in order&lt;br /&gt;         // to find the class.&lt;br /&gt;         c = findClass(name);&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt; if (resolve) {&lt;br /&gt;     resolveClass(c);&lt;br /&gt; }&lt;br /&gt; return c;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;it first checks the parent class loader to check the class and child class loader after that. We can revise this order simply overriding this method at the  DeploymentClassLoader like this,&lt;br /&gt;protected synchronized Class&lt;?&gt; loadClass(String name, boolean resolve) throws ClassNotFoundException {&lt;br /&gt;        Class c = null;&lt;br /&gt;        if (!isChildFirstClassLoading) {&lt;br /&gt;            c = super.loadClass(name, resolve);&lt;br /&gt;        } else {&lt;br /&gt;            c = findLoadedClass(name);&lt;br /&gt;            if (c == null) {&lt;br /&gt;                try {&lt;br /&gt;                    c = findClass(name);&lt;br /&gt;                } catch (Exception e) {&lt;br /&gt;                    c = super.loadClass(name, resolve);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return c;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Here the  isChildFirstClassLoading is set according to the parameters uses set above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-631500218677096513?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/631500218677096513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=631500218677096513' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/631500218677096513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/631500218677096513'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/05/axis2-child-first-class-loading.html' title='Axis2 child first class loading'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-1046234955808819838</id><published>2009-05-07T01:18:00.000-07:00</published><updated>2009-05-07T01:19:54.638-07:00</updated><title type='text'>Improving Axis2 client http transport performance</title><content type='html'>Although Axis2 supports a many transports http is the highly used one. Axis2 uses Apache HttpClient to implement its http transports sender. By default Axis2 creates a new http client object per invocation. This causes a new MultiThreadedHttpConnectionManager object being created for each invocation. As a result axis2 by default does not use the http 1.1 keep alive feature as well.&lt;br /&gt;The solution for this problem is to re use the same HttpClient and  MultiThreadedHttpConnectionManager per one thread. Axis2 client invocation may happen using one thread or using multiple threads. After reusing the  MultiThreadedHttpConnectionManager has to shut down to release connections. If not this can lead to multiple tcp CLOSE_WAIT connections situation.&lt;br /&gt;&lt;br /&gt;Following code shows this settings.&lt;br /&gt;&lt;br /&gt;// creates a new connection manager and a http client object&lt;br /&gt;MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();&lt;br /&gt;            HttpClient httpClient = new HttpClient(httpConnectionManager);&lt;br /&gt;&lt;br /&gt;            try {&lt;br /&gt;&lt;br /&gt;                client = new ServiceClient(null, null);&lt;br /&gt;                Options opts = new Options();&lt;br /&gt;                client.setOptions(opts);&lt;br /&gt;                opts.setTo(new EndpointReference("http://localhost:8085/axis2/services/TestInOutService"));&lt;br /&gt;                opts.setAction("urn:TestInOutService");&lt;br /&gt;&lt;br /&gt;                OMElement payload = buildSoapObject(&lt;br /&gt;                        "&lt;ns1:getPrice xmlns:ns1=\"http://quickstart.samples/xsd\"&gt;" +&lt;br /&gt;                                "&lt;ns1:symbol&gt;IBM&lt;/ns1:symbol&gt;" +&lt;br /&gt;                                "&lt;/ns1:getPrice&gt;"&lt;br /&gt;                );&lt;br /&gt;                System.out.println("Sending the request ...." + System.currentTimeMillis());&lt;br /&gt;&lt;br /&gt;                 &lt;br /&gt;                 // set the above created objects to re use.&lt;br /&gt;                client.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);&lt;br /&gt;                client.getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);&lt;br /&gt;                &lt;br /&gt;                // since we reuse the same http client and conneciton manager all these http messages&lt;br /&gt;                // will go in one tcp connection.&lt;br /&gt;                // this can be verified by sending the messages through tcpmon.&lt;br /&gt;                for (int i = 0; i &lt; 10; i++) {&lt;br /&gt;                    OMElement response = client.sendReceive(payload);&lt;br /&gt;                    response.build();&lt;br /&gt;                }&lt;br /&gt;                &lt;br /&gt;&lt;br /&gt;            } catch (Exception e) {&lt;br /&gt;                e.printStackTrace();&lt;br /&gt;            }&lt;br /&gt;            finally {&lt;br /&gt;                if (client != null) {&lt;br /&gt;                    try {&lt;br /&gt;                        client.cleanupTransport();&lt;br /&gt;                    } catch (Exception e) {&lt;br /&gt;                        e.printStackTrace();&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    try {&lt;br /&gt;                        client.cleanup();&lt;br /&gt;                    } catch (Exception e) {&lt;br /&gt;                        e.printStackTrace();&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            try {&lt;br /&gt;                Thread.sleep(1000);&lt;br /&gt;            } catch (Exception e) {// do nothing}&lt;br /&gt;            }&lt;br /&gt;            httpConnectionManager.closeIdleConnections(0);&lt;br /&gt;            httpConnectionManager.shutdown();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-1046234955808819838?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/1046234955808819838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=1046234955808819838' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/1046234955808819838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/1046234955808819838'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/05/improving-axis2-client-http-transport.html' title='Improving Axis2 client http transport performance'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-260447196284055775</id><published>2009-02-16T20:32:00.000-08:00</published><updated>2009-02-16T20:34:10.792-08:00</updated><title type='text'>Accessing WSO2 products back end directly</title><content type='html'>Recently wso2 release a set of products which address all aspects of any SOA solution. All these products are build upon a platform called WSO2 carbon which is base on OSGI. One of the common features of them is to ability to run as Front End (FE) and Back End (BE) services. FE server contains all the GUI components and BE server expose the back end functionality as web services. Therefore in a typical Adminconsole usage scenario client application runs on the browser makes servlet request to FE server and FE server makes a web service call to BE server.&lt;br /&gt;As it can be seen it is possible to access these BE serer web services directly using web service clients generated using the respective WSDL files for the service. The following example code provides a code for such a client which try to directly access the WS02 registry back end services to put a resource and retrieve it back. Generally this code segment show how one can access a service using https transport and mange cookies between many stubs.&lt;br /&gt;&lt;br /&gt;try {&lt;br /&gt;&lt;br /&gt;            // set the system properties to enable the https conection&lt;br /&gt;            System.setProperty("javax.net.ssl.trustStore", "src/test/resources/wso2carbon.jks");&lt;br /&gt;            System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");&lt;br /&gt;&lt;br /&gt;            // first authenticate the client.&lt;br /&gt;            AuthenticationAdminServiceStub authenticationStub =&lt;br /&gt;                    new AuthenticationAdminServiceStub("https://10.100.1.104:9443/services/AuthenticationAdminService");&lt;br /&gt;            authenticationStub._getServiceClient().getOptions().setManageSession(true);&lt;br /&gt;            boolean loggedIn = authenticationStub.login("admin", "admin", NetworkUtils.getLocalHostname());&lt;br /&gt;&lt;br /&gt;            // get the cooke to use in the next service invoations. This lets registry service to authenticate&lt;br /&gt;            // the second request&lt;br /&gt;            ServiceContext serviceContext = authenticationStub._getServiceClient().getLastOperationContext().getServiceContext();&lt;br /&gt;            String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);&lt;br /&gt;            // print the cookie&lt;br /&gt;            System.out.println("session Cookie " + sessionCookie);&lt;br /&gt;&lt;br /&gt;            // doing the registry update&lt;br /&gt;            ResourceAdminServiceStub stub = new ResourceAdminServiceStub("https://10.100.1.104:9443/services/ResourceAdminService");&lt;br /&gt;            stub._getServiceClient().getOptions().setManageSession(true);&lt;br /&gt;            stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(60000000);&lt;br /&gt;            // create a path to add new resource&lt;br /&gt;            String path = "/testfolder/axis2.zip";&lt;br /&gt;            String mediaType = "application/xml";&lt;br /&gt;            String description = "test service";&lt;br /&gt;            // enable MTOM and set the previous cookie&lt;br /&gt;            stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);&lt;br /&gt;            stub._getServiceClient().getOptions().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);&lt;br /&gt;            DataHandler dataHandler = new DataHandler(new FileDataSource("/home/amila/services.xml"));&lt;br /&gt;            // adding the resource&lt;br /&gt;            stub.addResource(path, mediaType, description, dataHandler);&lt;br /&gt;&lt;br /&gt;            // getting content&lt;br /&gt;            ContentDownloadBean contentDownloadBean = stub.getContentDownloadBean("/testfolder/testxml3");&lt;br /&gt;            DataHandler response = contentDownloadBean.getContent();&lt;br /&gt;            FileOutputStream fileOutputStream = new FileOutputStream("/home/amila/new_services2.xml");&lt;br /&gt;            response.writeTo(fileOutputStream);&lt;br /&gt;            fileOutputStream.flush();&lt;br /&gt;        } catch (AxisFault axisFault) {&lt;br /&gt;            axisFault.printStackTrace();&lt;br /&gt;        } catch (java.rmi.RemoteException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (org.wso2.carbon.registry.mgt.ui.resource.services.ExceptionException0 exceptionException0) {&lt;br /&gt;            exceptionException0.printStackTrace();&lt;br /&gt;        } catch (org.wso2.carbon.core.services.authentication.AuthenticationExceptionException0 authenticationExceptionException0) {&lt;br /&gt;            authenticationExceptionException0.printStackTrace();&lt;br /&gt;        } catch (SocketException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (FileNotFoundException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-260447196284055775?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/260447196284055775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=260447196284055775' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/260447196284055775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/260447196284055775'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/02/accessing-wso2-products-back-end.html' title='Accessing WSO2 products back end directly'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-8890528382150467972</id><published>2009-01-03T18:48:00.000-08:00</published><updated>2009-01-03T18:51:29.881-08:00</updated><title type='text'>Using MTOM with Axis2</title><content type='html'>MTOM provides a way to send binary data as it is without encoding it to a text format.  Axis2 ADB has built in support for MTOM. Therefore it is almost a trivial task to send and receive binary data using axis2.&lt;br /&gt;&lt;br /&gt;Here is an sample wsdl&lt;br /&gt;&lt;br /&gt;&amp;lt;definitions xmlns:tns="http//tempuri.org/sample"&lt;br /&gt;             xmlns:ns1="http//tempuri.org/sample/types"&lt;br /&gt;             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"&lt;br /&gt;             xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"&lt;br /&gt;             xmlns:xsd="http://www.w3.org/2001/XMLSchema"&lt;br /&gt;             xmlns="http://schemas.xmlsoap.org/wsdl/"&lt;br /&gt;             targetNamespace="http//tempuri.org/sample"&amp;gt;&lt;br /&gt;    &amp;lt;types&amp;gt;&lt;br /&gt;        &amp;lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&lt;br /&gt;                    xmlns:tns="http//tempuri.org/sample/types"&lt;br /&gt;                    targetNamespace="http//tempuri.org/sample/types"&lt;br /&gt;                    elementFormDefault="qualified"&lt;br /&gt;                    attributeFormDefault="unqualified"&amp;gt;&lt;br /&gt;            &amp;lt;xsd:element name="echoBinaryData"&amp;gt;&lt;br /&gt;                &amp;lt;xsd:complexType&amp;gt;&lt;br /&gt;                    &amp;lt;xsd:sequence&amp;gt;&lt;br /&gt;                        &amp;lt;xsd:element name="param" type="xsd:base64Binary"/&amp;gt;&lt;br /&gt;                    &amp;lt;/xsd:sequence&amp;gt;&lt;br /&gt;                &amp;lt;/xsd:complexType&amp;gt;&lt;br /&gt;            &amp;lt;/xsd:element&amp;gt;&lt;br /&gt;            &amp;lt;xsd:element name="echoBinaryDataResponse"&amp;gt;&lt;br /&gt;                &amp;lt;xsd:complexType&amp;gt;&lt;br /&gt;                    &amp;lt;xsd:sequence&amp;gt;&lt;br /&gt;                        &amp;lt;xsd:element name="param" type="xsd:base64Binary"/&amp;gt;&lt;br /&gt;                    &amp;lt;/xsd:sequence&amp;gt;&lt;br /&gt;                &amp;lt;/xsd:complexType&amp;gt;&lt;br /&gt;            &amp;lt;/xsd:element&amp;gt;&lt;br /&gt;        &amp;lt;/xsd:schema&amp;gt;&lt;br /&gt;    &amp;lt;/types&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;message name="EchoBinaryDataRequest"&amp;gt;&lt;br /&gt;        &amp;lt;part name="part1" element="ns1:echoBinaryData"/&amp;gt;&lt;br /&gt;    &amp;lt;/message&amp;gt;&lt;br /&gt;    &amp;lt;message name="EchoBinaryDataResponse"&amp;gt;&lt;br /&gt;        &amp;lt;part name="part1" element="ns1:echoBinaryDataResponse"/&amp;gt;&lt;br /&gt;    &amp;lt;/message&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;portType name="SamplePortType"&amp;gt;&lt;br /&gt;        &amp;lt;operation name="echoBinaryData"&amp;gt;&lt;br /&gt;            &amp;lt;input message="tns:EchoBinaryDataRequest"/&amp;gt;&lt;br /&gt;            &amp;lt;output message="tns:EchoBinaryDataResponse"/&amp;gt;&lt;br /&gt;        &amp;lt;/operation&amp;gt;&lt;br /&gt;    &amp;lt;/portType&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;binding name="SampleSoap11Binding" type="tns:SamplePortType"&amp;gt;&lt;br /&gt;        &amp;lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&amp;gt;&lt;br /&gt;        &amp;lt;operation name="echoBinaryData"&amp;gt;&lt;br /&gt;            &amp;lt;soap:operation style="document" soapAction="urn:echoBinaryData"/&amp;gt;&lt;br /&gt;            &amp;lt;input&amp;gt;&lt;br /&gt;                &amp;lt;soap:body use="literal"/&amp;gt;&lt;br /&gt;            &amp;lt;/input&amp;gt;&lt;br /&gt;            &amp;lt;output&amp;gt;&lt;br /&gt;                &amp;lt;soap:body use="literal"/&amp;gt;&lt;br /&gt;            &amp;lt;/output&amp;gt;&lt;br /&gt;        &amp;lt;/operation&amp;gt;&lt;br /&gt;    &amp;lt;/binding&amp;gt;&lt;br /&gt;    &amp;lt;binding name="SampleSoap12Binding" type="tns:SamplePortType"&amp;gt;&lt;br /&gt;        &amp;lt;soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&amp;gt;&lt;br /&gt;        &amp;lt;operation name="echoBinaryData"&amp;gt;&lt;br /&gt;            &amp;lt;soap12:operation style="document" soapAction="urn:echoBinaryData"/&amp;gt;&lt;br /&gt;            &amp;lt;input&amp;gt;&lt;br /&gt;                &amp;lt;soap12:body use="literal"/&amp;gt;&lt;br /&gt;            &amp;lt;/input&amp;gt;&lt;br /&gt;            &amp;lt;output&amp;gt;&lt;br /&gt;                &amp;lt;soap12:body use="literal"/&amp;gt;&lt;br /&gt;            &amp;lt;/output&amp;gt;&lt;br /&gt;        &amp;lt;/operation&amp;gt;&lt;br /&gt;    &amp;lt;/binding&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;service name="SampleService"&amp;gt;&lt;br /&gt;        &amp;lt;port name="Soap11Port" binding="tns:SampleSoap11Binding"&amp;gt;&lt;br /&gt;            &amp;lt;soap:address location="http://localhost:8080/axis2/services/SampleService"/&amp;gt;&lt;br /&gt;        &amp;lt;/port&amp;gt;&lt;br /&gt;        &amp;lt;port name="Soap12Port" binding="tns:SampleSoap12Binding"&amp;gt;&lt;br /&gt;            &amp;lt;soap:address location="http://localhost:8080/axis2/services/SampleService"/&amp;gt;&lt;br /&gt;        &amp;lt;/port&amp;gt;&lt;br /&gt;    &amp;lt;/service&amp;gt;&lt;br /&gt;&amp;lt;/definitions&amp;gt;&lt;br /&gt;&lt;br /&gt;then both client and server side code can be generated with the wsdl2java tool.&lt;br /&gt;&lt;br /&gt;it sends and receives a binary file. Following client and server side code can be used to send and receive binary data.&lt;br /&gt;try {&lt;br /&gt;            SampleServiceStub stub = new SampleServiceStub("http://localhost:8080/axis2/services/SampleService");&lt;br /&gt;            stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);&lt;br /&gt;            String clientFolder = "/home/amila/work/articles/binary/samples/mtom/client/";&lt;br /&gt;            DataSource dataSource = new FileDataSource(clientFolder + "client.jar");&lt;br /&gt;            DataHandler request = new DataHandler(dataSource);&lt;br /&gt;            DataHandler response = stub.echoBinaryData(request);&lt;br /&gt;            FileOutputStream fileOutputStream = new FileOutputStream(clientFolder + "server.jar");&lt;br /&gt;            response.writeTo(fileOutputStream);&lt;br /&gt;            fileOutputStream.flush();&lt;br /&gt;            System.out.println("Saved the file to client folder");&lt;br /&gt;        } catch (AxisFault axisFault) {&lt;br /&gt;            axisFault.printStackTrace();&lt;br /&gt;        } catch (java.rmi.RemoteException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (FileNotFoundException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;Skelton code.&lt;br /&gt;public javax.activation.DataHandler echoBinaryData&lt;br /&gt;            (&lt;br /&gt;                    javax.activation.DataHandler param&lt;br /&gt;            ) {&lt;br /&gt;&lt;br /&gt;        String serverFolder = "/home/amila/work/articles/binary/samples/mtom/server/";&lt;br /&gt;        try {&lt;br /&gt;            FileOutputStream fileOutputStream = new FileOutputStream(serverFolder + "client.jar");&lt;br /&gt;            param.writeTo(fileOutputStream);&lt;br /&gt;            fileOutputStream.flush();&lt;br /&gt;            System.out.println("Saved the file to client.jar");&lt;br /&gt;        } catch (FileNotFoundException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        FileDataSource fileDataSource = new FileDataSource(serverFolder + "server.jar");&lt;br /&gt;        DataHandler dataHandler = new DataHandler(fileDataSource);&lt;br /&gt;        return dataHandler;&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-8890528382150467972?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/8890528382150467972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=8890528382150467972' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/8890528382150467972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/8890528382150467972'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2009/01/using-mtom-with-axis2.html' title='Using MTOM with Axis2'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-40890766597923736</id><published>2008-12-25T03:45:00.000-08:00</published><updated>2008-12-25T03:50:59.752-08:00</updated><title type='text'>WSO2 WSAS 3.0-beta2 Released</title><content type='html'>&lt;a href="http://wso2.org/downloads/wsas"&gt;WSO2 WSAS 3.0-beta2&lt;/a&gt; is now available for public review.&lt;br /&gt;WSO2 WSAS is the enterprise version of widely used Axis2. WSO2 WSAS users the Axis2 and related other projects (Rampart, Sandesha2) to provide the Soap Stack &lt;a href="http://wso2.org/projects/wsas/java/features"&gt;functionality&lt;/a&gt;. It is shipped with a well tested version of these components (eg. Axis2 with some bug fixed version of Axis2 1.4.1) while supporting essential monitoring and administrative &lt;a href="http://wso2.org/projects/wsas/java/features"&gt;functionality&lt;/a&gt;. It supports scalability and high availability for web services with an improved and well tested clustering implementation.&lt;br /&gt;Based on &lt;a href="http://wso2.org/projects/carbon"&gt;WSO2 Carbon&lt;/a&gt; platform since version 3.0, It lets users even to add WSO2 ESB which is based on synapse and WSO2 Mashup functionalities with a minimal effort.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-40890766597923736?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/40890766597923736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=40890766597923736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/40890766597923736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/40890766597923736'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/12/wso2-wsas-30-beta2-released.html' title='WSO2 WSAS 3.0-beta2 Released'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-2254542821828295286</id><published>2008-11-30T05:46:00.000-08:00</published><updated>2008-11-30T05:51:39.356-08:00</updated><title type='text'>Low cost IT solutions</title><content type='html'>With the global economic crisis a lot of companies find it difficult to mange their IT budgets with the commercial proprietary software products. Most of these companies find Open source software products as a solution for there problem. &lt;br /&gt;This article named as &lt;a href="http://wso2.com/about/news/open-source-lets-developers-speed-soa-development-despite-economic-slowdown/"&gt;Open source lets developers speed SOA development despite economic slowdown&lt;/a&gt;&lt;br /&gt;describes how the company called &lt;a href="http://www.concur.com"&gt;concur&lt;/a&gt; have build there SOA solution using &lt;a href="http://wso2.org/"&gt;WSO2&lt;/a&gt; open source products.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-2254542821828295286?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/2254542821828295286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=2254542821828295286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2254542821828295286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2254542821828295286'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/11/low-cost-it-solutions.html' title='Low cost IT solutions'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-2498954636719380788</id><published>2008-11-30T04:59:00.000-08:00</published><updated>2008-11-30T05:04:49.637-08:00</updated><title type='text'>Axis2 service Invocations</title><content type='html'>Axis2 client API provides a comprehensive set of ways to access a web service. In fact there are four ways depending on the following two properties.&lt;br /&gt;&lt;br /&gt;1.Synchronous/Asynchronous invocations – whether client thread wait until response comes or not&lt;br /&gt;2.Single/Dual Channel invocations. - whether the response comes on the back channel or a separate channel initiated by the server.&lt;br /&gt;&lt;br /&gt;Now lets see each and every method separately.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;1.Synchronous Single channel&lt;/span&gt;&lt;br /&gt;In this way the client side invocation thread blocks until the response message comes. If the transport is Http it can be seen that the response comes at the back channel with Http status 200 ok. By default Axis2 works on the single channel mode. Therefore following method does the job. Note that this method returns the response.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;serviceClient.sendReceive(getTestOMElement())&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2.Asynchronous Single channel&lt;/span&gt;&lt;br /&gt;Unlike in the earlier way this kind of invocation returns the client thread immediately. User should register a callback to get the response. But response comes in the back channel as in the earlier case. Following code can be used for this kind of invocation.&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style:italic;"&gt;AxisCallback axisCallback = new AxisCallback() {&lt;br /&gt;            public void onMessage(MessageContext msgContext) {&lt;br /&gt;                System.out.println("Got the message ==&gt; " + msgContext.getEnvelope().getBody().getFirstElement());&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public void onFault(MessageContext msgContext) {&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public void onError(Exception e) {&lt;br /&gt;                 System.out.println("Received an error ...");&lt;br /&gt;             }&lt;br /&gt;&lt;br /&gt;            public void onComplete() {&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;        };&lt;br /&gt;        serviceClient.sendReceiveNonBlocking(getTestOMElement(), axisCallback);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3.Synchronous Dual channel mode&lt;/span&gt;&lt;br /&gt;The only difference of this invocation compare to others is that the invocation happens using two different http channels. This type of invocation can only be done using Addressing. i.e both client and service should have addressing enabled.  Before sending the request Axis2 client starts a Simple Http server at client side and set the Endpoint reference address of this server to the reply-To addressing header.  The request channel receives a Http 202 Accepted header. Server reads the reply-to header from the request and starts a new channel to the reply-to header address. Here is the code for this.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;serviceClient.engageModule("addressing")&lt;br /&gt;serviceClient.getOptions().setUseSeparateListener(true);&lt;br /&gt;serviceClient.sendReceive(getTestOMElement());&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; The useSeparateListener attribute is used to specify this dual channel mode.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;4.Asynchronous Dual channel mode&lt;/span&gt;&lt;br /&gt;This is the complete asynchronous invocation method. Client immediately returns the thread and response message receive in a separate channel. This kind of access can be made by adding the addressing engaging and useSeperateListner code for the second type of invocation.&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style:italic;"&gt;AxisCallback axisCallback = new AxisCallback() {&lt;br /&gt;            public void onMessage(MessageContext msgContext) {&lt;br /&gt;                System.out.println("Got the message ==&gt; " +  msgContext.getEnvelope().getBody().getFirstElement());&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public void onFault(MessageContext msgContext) {&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            public void onError(Exception e) {&lt;br /&gt;                e.printStackTrace();&lt;br /&gt;                System.out.println("Received an error ...");&lt;br /&gt;             }&lt;br /&gt;&lt;br /&gt;            public void onComplete() {&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;        };&lt;br /&gt;        serviceClient.engageModule("addressing")&lt;br /&gt;        serviceClient.getOptions().setUseSeparateListener(true);&lt;br /&gt;        serviceClient.sendReceiveNonBlocking(getTestOMElement(), axisCallback);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-2498954636719380788?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/2498954636719380788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=2498954636719380788' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2498954636719380788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/2498954636719380788'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/11/axis2-service-invocations.html' title='Axis2 service Invocations'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-3065532679010430101</id><published>2008-11-13T22:30:00.000-08:00</published><updated>2008-11-13T22:43:11.315-08:00</updated><title type='text'>Getting java runtime stack trace</title><content type='html'>In most of the time finding java runtime stack trace is useful in debugging. The common practice is to run the application in debug mode and find the stack trace.&lt;br /&gt;Here is a way I found to print the stack trace within the java code it self without running in debug mode. I found this in JavaUtils class of the Axis2 kernel.&lt;br /&gt;&lt;br /&gt;     public static String callStackToString() {&lt;br /&gt;        return stackToString(new RuntimeException());&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static String stackToString(Throwable e) {&lt;br /&gt;        java.io.StringWriter sw = new java.io.StringWriter();&lt;br /&gt;        java.io.BufferedWriter bw = new java.io.BufferedWriter(sw);&lt;br /&gt;        java.io.PrintWriter pw = new java.io.PrintWriter(bw);&lt;br /&gt;        e.printStackTrace(pw);&lt;br /&gt;        pw.close();&lt;br /&gt;        String text = sw.getBuffer().toString();&lt;br /&gt;        // Jump past the throwable&lt;br /&gt;        text = text.substring(text.indexOf("at"));&lt;br /&gt;        text = replace(text, "at ", "DEBUG_FRAME = ");&lt;br /&gt;        return text;&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-3065532679010430101?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/3065532679010430101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=3065532679010430101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3065532679010430101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3065532679010430101'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/11/getting-java-runtime-stack-trace.html' title='Getting java runtime stack trace'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-911036345188458051</id><published>2008-11-05T22:50:00.000-08:00</published><updated>2008-11-05T22:52:25.219-08:00</updated><title type='text'>Accessing Axis2 Information at Client and Service</title><content type='html'>Most of the people get used to implement web services either using POJO or generated services with wsdl using wsdl2java tool. The preferred way to generate the client code is again to use wsdl2java tool with service wsdl. In other words people preferred to use data bound java classes. &lt;br /&gt;But sometimes they need to get inside information even at the Client and service level. Axis2 internally keep XML data as an Axiom object. It uses the context hierarchy in processing data. For each message Axis2 creates a message context which is bound to an Operation Context. Normally an Operation Context can have one or two message contexts depending on the Operation MEP (message exchange pattern). Therefore if there is a way to get access to Message Context or Operation Context all these details can be retrieved by using them.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;At server side.&lt;/span&gt;&lt;br /&gt;At the server side message context can be accessed like this,&lt;br /&gt;MessageContext messageContext = MessageContext.getCurrentMessageContext(); &lt;br /&gt;&lt;br /&gt;once get the message context then any thing can be access from that &lt;br /&gt;messageContext.getEnvelope(); // getting soap envelop&lt;br /&gt;            messageContext.getProperties(); // getting all the properties these inclued properties set by transports as well&lt;br /&gt;            messageContext.getOperationContext(); // accessing operation context&lt;br /&gt;            messageContext.getAxisOperation(); // axis operation information&lt;br /&gt;            messageContext.getAxisService(); // axis servier information &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;At the client side.&lt;/span&gt; &lt;br /&gt;At the client side operation context can be accessed like this,&lt;br /&gt;OperationContext operationContext = stub._getServiceClient().getLastOperationContext();&lt;br /&gt;            MessageContext outMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_OUT);&lt;br /&gt;            MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);&lt;br /&gt;&lt;br /&gt;Once got the message context other can be accessed as given above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-911036345188458051?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/911036345188458051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=911036345188458051' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/911036345188458051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/911036345188458051'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/11/accessing-axis2-information-at-client.html' title='Accessing Axis2 Information at Client and Service'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-3400009322946631220</id><published>2008-11-03T23:07:00.000-08:00</published><updated>2008-11-04T00:03:44.501-08:00</updated><title type='text'>Minimal jars to run Apache Axis2</title><content type='html'>Apache Axis2 distributions comes with number of jars which are used in various services. Out of these 60 jar files there are only a few needs for some applications. Actually the minimum set of jars depends on the service type to be used.&lt;br /&gt;&lt;br /&gt;Here is a list of jars required to Deploy a service created by using wsdl2java tool using ADB databinding. This jars set is taken from Axis2 1.4.1 release.&lt;br /&gt;&lt;br /&gt;axis2-kernel-1.4.1.jar&lt;br /&gt;commons-logging-1.1.1.jar&lt;br /&gt;geronimo-stax-api_1.0_spec-1.0.1.jar&lt;br /&gt;wstx-asl-3.2.4.jar&lt;br /&gt;wsdl4j-1.6.2.jar&lt;br /&gt;XmlSchema-1.4.2.jar&lt;br /&gt;axiom-impl-1.2.7.jar&lt;br /&gt;axiom-dom-1.2.7.jar&lt;br /&gt;axiom-api-1.2.7.jar&lt;br /&gt;backport-util-concurrent-3.1.jar&lt;br /&gt;neethi-2.0.4.jar&lt;br /&gt;commons-httpclient-3.1.jar&lt;br /&gt;activation-1.1.jar&lt;br /&gt;commons-fileupload-1.2.jar&lt;br /&gt;woden-api-1.0M8.jar&lt;br /&gt;woden-impl-dom-1.0M8.jar&lt;br /&gt;httpcore-4.0-beta1.jar&lt;br /&gt;axis2-adb-1.4.1.jar&lt;br /&gt;commons-codec-1.3.jar&lt;br /&gt;&lt;br /&gt;For additional binding corresponding runtime jars for that binding is required. (i.e for  xmlbeans-2.3.0.jar)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-3400009322946631220?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/3400009322946631220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=3400009322946631220' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3400009322946631220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3400009322946631220'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/11/minimal-jars-to-run-apache-axis2.html' title='Minimal jars to run Apache Axis2'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-6173883705529912813</id><published>2008-10-15T10:47:00.000-07:00</published><updated>2008-10-15T10:49:09.363-07:00</updated><title type='text'>How Axis2 Engine works</title><content type='html'>Axis2 Engine is one of the most important parts of Axis2 message processing. Axis2 Engine is responsible for invoking the Phases (Phase is a collection of handlers) which are supposed to invoke for a given message context object. Once Axis2 Engine invokes a Phase, then the Phase invokes the handlers for that phase in a similar a manner.  Axis2 Engine uses currentHandlerIndex variable which is stored in messageContext to keep a track of executed phases. &lt;br /&gt; Axis2 supports mainly two flows of message processing, namely Out flow and In flow. To support these two flows Axis2 has two methods called send() and receive() respectively. &lt;br /&gt; Before calling to the send() method, Axis2 assume that the AxisService and AxisOperation has already been set to the messageContext. Normally Axis2 client calls the send() method. Therefore at the send() method it creates the handler chain by getting the Operation specific handler chain and global handler chain. Then it invokes the each phase as mentioned earlier.&lt;br /&gt; Unlike in the send() method, when calling to the receive() method most of the time by the transport receiver, both AxisOperation and AxisService has not been found in the messageContext. Therefore at the receive method first it invoke the Global phases or Inflow chain which is stored in the AxisConfiguration. The main idea of this global phases is to dispatch the message (i.e. finding the AxisService and AxisOperation according to the parameters of the messageContext). Distpatch phase is the last phase of this chain.  After Dispatch phase AxisService and AxisOperation should have been found. This is checked at the checkPostConditions method of the DispatchPhase class. If the dispatch information is found handler chain is populated with the operation specific handlers and continue the execution. Otherwise it throws an exception.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-6173883705529912813?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/6173883705529912813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=6173883705529912813' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/6173883705529912813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/6173883705529912813'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/10/how-axis2-engine-works.html' title='How Axis2 Engine works'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-641337794071123859</id><published>2008-09-29T22:07:00.000-07:00</published><updated>2008-09-29T22:20:45.866-07:00</updated><title type='text'>Using WS-commons mail transport with Axis2</title><content type='html'>Axis2 and Synapse (an ESB which uses Axis2) were using separate set of codes for transports while keeping them in Axis2 and Synapse code repositories. Recently we moved then into a common place under the ws_commons project called transports. As a result of this now Axis2 uses the mail transport which was originally there with the Synapse and have removed its own mail transport.&lt;br /&gt;Compared to earlier Axis2 mail transport Synapse mail transport configure a mail box parameters per service and do not use ?x-service-path to specify the service.&lt;br /&gt;&lt;br /&gt;I recently had some tests with this transport and here is how this mail transport can be used with Axis2 for inonly and inout message operations.&lt;br /&gt;&lt;br /&gt;First here is how to use it with a in only operation.&lt;br /&gt;For in only operations we need to set the mail message receiver at the server (for service) and sender at the client. To configure the mail message receiver at server side first it is required to declare the Mail transport receiver at the Axis2 xml file and it should be looked like this,&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/transportReceiver&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note that there are no parameters specified here as in with the previous Axis2 mail transports. then where we specify them? it should be done at services.xml as entry per service.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;service name="TestInService"&amp;gt;&lt;br /&gt;    &amp;lt;description&amp;gt;Test In Service&amp;lt;/description&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="transport.mail.Address"&amp;gt;mail address to listen&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="transport.mail.Protocol"&amp;gt;pop3&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="transport.PollInterval"&amp;gt;2&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="mail.pop3.host"&amp;gt;pop3 mail account&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="mail.pop3.user"&amp;gt;username&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="mail.pop3.password"&amp;gt;password&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;messageReceivers&amp;gt;&lt;br /&gt;        &amp;lt;messageReceiver&lt;br /&gt;                mep="http://www.w3.org/2004/08/wsdl/in-only"&lt;br /&gt;                class="com.test.transports.service.TestInOnlyMessageReceiver"/&amp;gt;&lt;br /&gt;    &amp;lt;/messageReceivers&amp;gt;&lt;br /&gt;    &amp;lt;operation name="TestInOperation" mep="http://www.w3.org/ns/wsdl/in-only"&amp;gt;&lt;br /&gt;        &amp;lt;actionMapping&amp;gt;urn:TestInOperation&amp;lt;/actionMapping&amp;gt;&lt;br /&gt;    &amp;lt;/operation&amp;gt;&lt;br /&gt;&amp;lt;/service&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;These are the only steps to follow to mail transport at server side.&lt;br /&gt;At the client side we need to first declare a mail sender.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;transportSender name="mailto"&lt;br /&gt;                 class="org.apache.axis2.transport.mail.MailTransportSender"&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="mail.smtp.from"&amp;gt;from address this is added to from header&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="mail.smtp.user"&amp;gt;user name&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="mail.smtp.password"&amp;gt;password&amp;lt;/parameter&amp;gt;&lt;br /&gt;    &amp;lt;parameter name="mail.smtp.host"&amp;gt;smtp host&amp;lt;/parameter&amp;gt;&lt;br /&gt;&amp;lt;/transportSender&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Sender configuration is almost similar to earlier Axis2 sender configuration. Now we can use this code to send the message using mail transport.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    ConfigurationContext configurationContext =&lt;br /&gt;                    ConfigurationContextFactory.createConfigurationContextFromFileSystem(&lt;br /&gt;                            AXIS2_REPOSITORY_LOCATION, AXIS2_CLIENT_CONFIG_FILE);&lt;br /&gt;    ServiceClient serviceClient = new ServiceClient(configurationContext, null);&lt;br /&gt;    serviceClient.setTargetEPR(new EndpointReference("mailto:test@wso2.com"));&lt;br /&gt;    serviceClient.getOptions().setAction("urn:TestInOperation");&lt;br /&gt;    serviceClient.fireAndForget(getTestOMElement("org"));&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note here that it is enough to specify the email address of the server. Since there is a particular receiver for this service, it will pick the message from there.&lt;br /&gt;&lt;br /&gt;Now lets see how we can use mail transport for an inout operation. The smtp transport does not have an implicit back channel. Therefore response should come as a separate mail message. The request message will go to the server as in the inonly scenario. So now lets see how to configure to receive the response message. &lt;br /&gt;First a mail sender should be configured at the Axis2 xml in the server side as given above. So that the server can send the response using this transport sender. Server picks the sending address either using WSA reply to header if given or SMTP reply to header. &lt;br /&gt;To configure the receiver at the client side first we need to add the mail transport receiver at the client Axis2 xml file as given above. Then the there is a question of how to set the other parameters since there is no any services.xml file at the client side. Actually mail transport receiver gets these parameters from the Axis2 service and hence we can set them at the client code itself like this.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;     ConfigurationContext configurationContext =&lt;br /&gt;                    ConfigurationContextFactory.createConfigurationContextFromFileSystem(&lt;br /&gt;                            AXIS2_REPOSITORY_LOCATION, AXIS2_CLIENT_CONFIG_FILE);&lt;br /&gt;     ServiceClient serviceClient = new ServiceClient(configurationContext, null);&lt;br /&gt;     serviceClient.setTargetEPR(new EndpointReference("mailto:oiositest2@wso2.com"));&lt;br /&gt;     serviceClient.getOptions().setAction("urn:TestInOutOperation");&lt;br /&gt;            &lt;br /&gt;     // these two lines are needed only if it is required to use addressing&lt;br /&gt;     serviceClient.getOptions().setUseSeparateListener(true);&lt;br /&gt;     serviceClient.engageModule("addressing");&lt;br /&gt;&lt;br /&gt;     serviceClient.getAxisService().addParameter("transport.mail.Address","test@wso2.com");&lt;br /&gt;     serviceClient.getAxisService().addParameter("transport.mail.Protocol","pop3");&lt;br /&gt;     serviceClient.getAxisService().addParameter("transport.PollInterval","2");&lt;br /&gt;     serviceClient.getAxisService().addParameter("mail.pop3.host","pop 3 address");&lt;br /&gt;     serviceClient.getAxisService().addParameter("mail.pop3.user","username");&lt;br /&gt;     serviceClient.getAxisService().addParameter("mail.pop3.password",”password");&lt;br /&gt;&lt;br /&gt;     OMElement result = serviceClient.sendReceive(getTestOMElement("org"));&lt;br /&gt;     System.out.println("Result ==&gt; " + result);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There will be a separate listener for the given mail address and that receives the response.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-641337794071123859?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/641337794071123859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=641337794071123859' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/641337794071123859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/641337794071123859'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/09/using-ws-commons-mail-transport-with.html' title='Using WS-commons mail transport with Axis2'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7771139035631272063.post-3249275915190692080</id><published>2008-09-16T03:27:00.000-07:00</published><updated>2008-09-16T03:28:59.410-07:00</updated><title type='text'>Running WSO2 WSAS on WebLogic</title><content type='html'>&lt;style type="text/css"&gt;&lt;/style&gt;   &lt;p style="margin-bottom: 0in;"&gt;&lt;a href="http://wso2.org/projects/wsas/java"&gt;WSO2 WSAS&lt;/a&gt; can be used not only as a standalone application but also as an web application for a servlet container. Many people find latter very useful since that let them run the &lt;a href="http://wso2.org/projects/wsas/java"&gt;WSO2 WSAS&lt;/a&gt; within their favorite Servlet Container along with the other applications.  &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;I recently had some experiments with the WebLogic server using the &lt;a href="https://wso2.org/library/880"&gt;10 Minute Guide to Installing WSO2 WSAS&lt;/a&gt; on WebLogic Tutorial written by &lt;a href="http://afkham.org/"&gt;Afkham Azzez&lt;/a&gt;. Every thing worked fine in the installation process.  &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;Then I tried to do more experiments with some &lt;a href="http://wso2.org/projects/commons/mercury"&gt;WSO2 Mercury&lt;/a&gt; samples. By doing this I found that the response messages are not serialized properly. Further looking into that I found when running on Weblogic &lt;a href="http://ws.apache.org/commons/axiom/index.html"&gt;Axiom&lt;/a&gt; uses the underline stax implementation of the WebLogic and that causes some problems of serializing the namespaces and namespace prefixes.  &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;This made me surprised since &lt;a href="http://ws.apache.org/commons/axiom/index.html"&gt;Axiom&lt;/a&gt; supposed to work with any stax implementation. Then I looked into the Axiom serialization logic and found that it works on two different ways.&lt;/p&gt; &lt;ol&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;For some stax implementations it     first writes the prefix for a new namespace&lt;/p&gt;     &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;For some stax implementations it     writes the prefix after start Element&lt;/p&gt;     &lt;p style="margin-bottom: 0in;"&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt; &lt;p style="margin-bottom: 0in;"&gt;For wstx (default for Axis2) and sun stax implementations it works on the later mode and that has done by specifying these names at the serializing logic.  I specified the weblogic also as a later mode implementation and that made every thing worked fine.  &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;I have made these changes already to &lt;a href="http://ws.apache.org/commons/axiom/index.html"&gt;Axiom&lt;/a&gt; and any one having problems working in weblogic can try with Axiom nightly builds.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7771139035631272063-3249275915190692080?l=amilachinthaka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://amilachinthaka.blogspot.com/feeds/3249275915190692080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7771139035631272063&amp;postID=3249275915190692080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3249275915190692080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7771139035631272063/posts/default/3249275915190692080'/><link rel='alternate' type='text/html' href='http://amilachinthaka.blogspot.com/2008/09/running-wso2-wsas-on-weblogic.html' title='Running WSO2 WSAS on WebLogic'/><author><name>Amila Suriarachchi</name><uri>http://www.blogger.com/profile/15162735185293537609</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_vnM6uS_XAjM/TEvJKIy5F1I/AAAAAAAAACQ/x6ILUR4j3Gk/S220/amila2.jpg'/></author><thr:total>0</thr:total></entry></feed>
