Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by CyrilleLeClerc:
http://wiki.apache.org/ws/FrontPage/Axis/AxisCommonsHTTP

The comment on the change is:
add doc on single instantation of ServiceLocator + others

------------------------------------------------------------------------------
  AxisProperties.setProperty(
      DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_SO_TIMEOUT_KEY, 
soTimeout);
  
- // you can then call your web service as usual
+ // Instantiate the ServiceLocator only ONCE !!!
+ HelloWorldServiceLocator helloWorldServiceLocator = new 
HelloWorldServiceLocator();
+ 
+ ...
+ 
+ // reuse the same ServiceLocator to instantiate all your bindings !!
+ HelloWorldBindingStub bindingUserTic = (HelloWorldBindingStub) 
helloWorldServiceLocator
+    .gethelloWorldBinding();
  
  }}}
+ 
+ (!) '''Service``Locator MUST be instantiated only once'''. This single 
instance must be used to instantiate all the stubs.
+  This requirement is due to the fact that it is the Service``Locator that in 
in charge of pooling the http connections  : it holds the 
{{{MultiThreadedHttpConnectionManager}}} via the reference to the 
{{{CommonsHTTPSender}}}.
+ 
+ (!) '''Stubs are NOT thread safe''', in most cases, one stub can be 
instantiated for each call.
+  In very special cases (very complex WSDLs, ...), the cost of instantiating 
Stubs will worth pooling them.
+ 
+ (!) As stated before, '''Stubs are reusable'''. This is the common scenario 
to maintain a session (see Self:FrontPage/Axis/SessionSupport). It can also be 
used to gain performances (with a pool) but it should only be efficient in very 
special cases (see above).
+ 
+ '''Q: Can I share the same http connections (ie 
Multi``Threaded``Http``Connection``Manager) between Web Services ?'''
+ 
+ In Axis 1.3, the {{{MultiThreadedHttpConnectionManager}}} is an internal of 
the Service``Locator and thus, it is not possible to share the same 
{{{MultiThreadedHttpConnectionManager}}} between several Service``Locators 
(i.e. between several web services).
  
  '''Further readings'''
  

Reply via email to