Timeout in Axis2 Web Services Client

This is how we set timeout when we call a web services.

public static void main(String[] args) {
MyTimeoutSampleMainmain = new MyTimeoutSampleMain();
try {
MyTimeoutSampleStub stub = new MyTimeoutSampleStub(“http://xxxxx/webservices”);
long soTimeout = 2 * 60 * 1000; //2 minutes
soTimeout = 2 * 1000;

stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(soTimeout);

getResponseFromWebServices(stub);
}
catch (AxisFault ex) {
ex.printStackTrace();
}

}