Posted in general on June 27, 2010 |
Leave a Comment »
These days I am reading two different translations of the same book “Go Rin No Sho” a book originally written by famous Japanese warrier Miyamoto Mushashi(1584-1646). Why two translations of the same book and why I read both?. To understand let’s go into some detail.
Miyamoto Mushashi lived in a time where Feudal Japan is ruled by various warrier clans. He was a wondering Samurai (Ronin) who travelled alone honing his sword skills. He faced many duals with famous Samurai many of which were between life and death.
He survived all the duals he fought and later his life he lived an ascetic life and just few months before his death wrote “A book of five rings”. This book was about strategy. The strategies he learned from his life and death duals and his life long learning. Those days his followers used these strategies in real war. As time passed when business became the war between people, companies and nations, some started to use those strategies in business.
The translation by Victor Harris try to interpret the original content intended by Mushashi. The translation by Thomas Cleary try to interpret the ideas targeting the business world.
The idea is that wherever strategy is involved these ancient techniques still give insight into winning. Present WBA heavyweight boxing champion David Haye said that his camp trained according to Art of War by Sun Tzu, another ancient strategy book famous among todays strategists. His opponent was seemingly ahead of every aspect but to astonishment of many(including me), he won the fight.
It is said that Australian cricket team and Philiphines Manny Pacquiao(currently WBO welter weight champ) and many other sport teams also use Art of War.
Some of the well know general guide lines of Mushashi are as follows
|1. Do not think dishonestly.
|2. The Way is in training.
|3. Become acquainted with every art.
|4. Know the Ways of all professions
|5. Distinguish between gain and loss in worldly matters.
|6. Develop an intuitive judgement and understanding for everything.
|7. Perceive those things which cannot be seen.
|8. Pay attention even to trifles.
|9. Do nothing which is of no use.
Read Full Post »
I have a proxy service deployed in my esb server. This service will verify the signature of the incoming messages and decrypt them before sending it to the target service. I send the messges to ESB using WSO2 wsclient which is bundled with WSO2 WSF/C. To sign the messages I use Alice’s private key. To encrypt the messages I use the public key received from ESB ( You can find Alice’s samples keys bundled with WSF/C samples. More on ESB keys during this article).
To deploy that service I followed the following procedure. I first created a simple pass through service using the Add/Proxy Service menu. I gave the target server as my WSAS instance running on a separate server. After that I selected the created proxy service and added security using the Sign and Encrypt option. I also gave the private and trusted key store as wso2carbon.jks. I also added Alice’s public key to the wso2carbon.jks key store using WSO2 ESB admin console facilities.
Now my services are ready, I wanted to use WSO2 wsclient (A command line web services client tool) to access the service through ESB. To learn more about how to use wsclient and how to secure your messages using it please refer to  and . To encrypt and sign messages wsclient use server certificate in PEM format. We give the server certificate using –recipient-certificate option. Usually I use my wsclient command line tool to access web services deployed in Apache2 server. So I knew how to generate my server certificates in PEM format from PKCS key stores. But did not know how to generate PEM certificates from JKS key stores. Howerver I could not find a direct way to do this. Following is how I did this using java keytool and openssh x509 commands.
keytool -export -file wso2carbon.cer -keystore /wso2carbon.jks -alias wso2carbon
In this step we create a wso2carbon.cer file using wso2carbon.jks server keystore. Here you will be asked the password for the keystore entry alias.
After that I executed the following command to create the recipient certificate in PEM format.
openssl x509 -out wso2carbon.pem -outform pem -in wso2carbon.cer -inform der
Now I could use the created pem certificate to execute the following command to access the service
./wsclient –log-level error –no-wsa –soap –no-mtom –sign-body –key /alice_key.pem –certificate /alice_cert.cert –recipient-certificate /wso2carbon.pem –encrypt-payload –policy-file ./policy.xml http://localhost:8280/services/SignEncProxy < ./data/POService.xml
Read Full Post »
Posted in general on June 18, 2010 |
Leave a Comment »
Samurai warriors are famous for their dedication to the master. They are trained to do or die for the master’s cause. They preferred self sacrificing through the traditional suicide method called ‘Hara Kiri’ rather than betraying his master. There are so many tales of Samurai bravery and honesty.
Some say that Japanese army inherited this mindset of Samurai. Even when Japanese army is defeated during WW2 they still refused to surrender. Army generals preferred dying in the battle rather than surrender. There were so many Hara-kiri’s in Japanese military hierarchy during the last phase of the war.
Some say still Japanese people carry this Samurai mentality in there genes. Once I happen to work with some Japanese co-workers for some time. From my experience with them, I believe that they are inherited this mindset still but in a different form. Now their Feudal master is replaced by the company they work for. The war is replaced with business. In business they play a do or die attitude. They consider their company’s or country’s failure, as their own failure. Japanese economy is their own personal problem. They consider leaving one’s company is kind of betrayal. It is kind of black mark in their carrier if they happen to leave the company.
Perhaps this mindset is partly the main force behind Japans Economic success during late 20′th century.
My personal belief is that nations that did not surrender to a super power during past centuries are proud about the fact. Some people say it is a waste, that in some contries they still maintain the feudal monarchies, at least symbolically. But I think that symbolises those nation’s pride. That pride is in their genes. That help them to rise as a nation.
Sri Lanka had completely surrendered to Britain after their long standing struggle for survival. They lost their Monarchy completely.I think that completely affected the minds of native people.
I think Sri Lankan people (and in that respect Asians) are not political beings. They completely rely on the King to rule the country. King is trained from childhood for that purpose. History says that most of the Kings executed that responsibility to the word. People had pride in their country and in their King. So when they lost their King and their Sovereignty, it was a great mental blow from which they still could not survive as a nation.
Every native became desperate. “Ko apata Rajek?”(Where is a king for us now?”). That question plagued the mind of the native.
I believe after two centuries they still carry that question in the back of their mind. I am not concerned whether this is right or wrong, but as a fact people still want the king to do the ruling and leave them in their own peaceful living.
Read Full Post »
There are many ways you can write a web service and deploy it in WSO2 WSAS application server environment. I already to explained how to deploy your POJO service in Eclipse platform.
Here I’ll explain in detail the top down approach(Contract first) using WSAS admin console. I don’t use Eclipse platform here. An WSO2 Oxygentank article, “Deploying Web Services using Apache Axis2 Eclipse Plugins” explain using Eclipse plugins for deploying your web services using contract first approach.
I started code generating for POWSDL
I used the WSO2 WSAS admin UI to generate my service code. Select the WSDL2Java tool under tools menu. In the -uri option select the wsdl from your filesystem and upload it. I selected the options -ss, -sd and -u. When you click generate it will generate the code and download it to your local file system as a zip file.
I unzipped this file and add my server code at src/org/wso2/carbon/core/services/po/POServiceSkeleton.java as
public org.wso2.carbon.core.services.po.BuyStocks buyStocks
Note that at the root of the unzipped folder there is a pom.xml file. So you execute mvn to build your source. If you have a maven repository already with required jars it is advised to use mvn with -o option so that maven will not download already existing jars in your repository.
When the build is completed you will have target/build/lib/POService.aar ready to be deployed in WSO2 WSAS.
I then uploaded this in to WSAS as an Axis2 service. To do that in WSAS admin UI under services menu select add Axis2 Service sub menu. Then just browse to your aar file and click upload. Your POService will be listed in the services list.
Read Full Post »