Arvind Purohit wrote:Hi All
I am new to web services. I have written a java class.
But I am not getting how to deploy it. I mean do i need web server or app server . As this is simple java class i can not make WAR file to deploy it . So what is the method to deploy it and which server should i use.
When I am running this program from eclipse and typing http://localhost:9191/wisequotes?wsdl in browser i can see some wsdl file but when i am running this program from command line i am getting error No Class def found error WiseQuoteServer
Ivan Krizsan wrote:Hi!
You should not store client-specific state in instance variables of the service.
In your example, there is no reason for having two operations. Instead you should have only one that takes an User object as input and returns an User.
Do not use instance variables in the service!
If you must have a stateful web service, then you can have an operation that receives some data, stores it in a database and assigns an unique id to it.
The id is returned to the client and, when invoking subsequent operations on the service that requires access to the data, the client supplies the unique id.
This is, however, still a bad idea, since it will seriously complicate scaling of the service - it is all good and well if you run in one single instance of the service, but imagine the case when you have a layer 4 switch or similar in front of a cluster of servers, each running an instance of the service. In such a scenario, you do not want to use one single database to store all the data, since it will become the bottleneck of the system.
Stateless web services do not need to share any data and can thus be easily scaled.
Best wishes!
Tom Reilly wrote:I don't know if this is your problem but you are not closing your connection, statement or result set. I see you are also eating the DatabaseInitializationException in getInstance().