• Post Reply Bookmark Topic Watch Topic
  • New Topic

Set WebService as a Singleton

 
Enrico Oliosi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all,
I implemented a web service using Axis. When I generated the service (with Eclipse autogeneration from a
java class) the IDE generation modified (correctly) the web.xml file adding the rows for AxisServlet configuration.

When I invoke the web service from a client app the web service class is always created, its costructor method is
always called.

Is it possible work in a singleton mode? For this project I don't use a dependency injection container (e.g Spring) and, if possible,
I wouldn't like use it.

Thk a lot.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the actual problem caused by object creation? You can move any initialization that should occur only once per class to a static { ... } block.
 
Enrico Oliosi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Lester for you answer, maybe I fixed the problem. In wsdd file, where
I define the service like this:

I added a parameter name "scope" and setted the value to "application"

For details: Axis Reference Guide
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!