This is just an opinion, but if you want to adhere to a 100% REFUSAL, your web service should be stateless. Initializing shared objects in calls to a web service method implies state, so this is not a good idea. *
* This is debatable, as can be seen in the comments. However, any synchronization and shared object initialization, if IMO is not required, should be no-no in REST applications.
The contractor is definitely a solution, it would be even better to use dependency injection and inject the object you need into your webservice instance when you create it.
source share