ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Apache Web Services Wiki] New: FrontPage/Axis/AxisClientConfiguration
Date Tue, 11 Jan 2005 11:14:57 GMT
   Date: 2005-01-11T03:14:57
   Editor: ToshiyukiKimura
   Wiki: Apache Web Services Wiki
   Page: FrontPage/Axis/AxisClientConfiguration

   Importing old wiki ...

New Page:


'''How do I setup handlers in Axis clients?'''

When instantiating a Service-object, you can provide your own {{{ EngineConfiguration }}}.
There are several ways to build a configuration of your desire: 

 * Use WSDD-XML like for server-side deployment-descriptors 
This example configures the {{{ SimpleSessionHandler }}} in the request- and response-flow
of a HTTP-transport-chain: 

     <deployment xmlns="" xmlns:java="..." > 
       <handler type="java:org.apache.axis.handlers.SimpleSessionHandler" 
       <transport name="http" 
         <requestFlow><handler type="SimpleSessionHandler"/></requestFlow>

         <responseFlow><handler type="SimpleSessionHandler"/></responseFlow>

The code to get an {{{ EngineConfiguration }}} from this given as a String: 

     EngineConfiguration clientConfig = (EngineConfiguration) new ["XMLStringProvider"](WSDDString);

 * Build your own class, that implements the {{{ EngineConfiguration }}} interface 
 * Use an existing {{{ EngineConfiguration }}}-class that is configurable in parts 
The {{{ SimpleProvider }}}, for example, allows deployment of Transport chains The following
example does about the same as the WSDD above: 

     import org.apache.axis.configuration.SimpleProvider; 
     import org.apache.axis.EngineConfiguration; 
     import org.apache.axis.Handler; 
     import org.apache.axis.SimpleChain; 
     import org.apache.axis.SimpleTargetedChain; 
     import org.apache.axis.handlers.SimpleSessionHandler; 
     import org.apache.axis.transport.http.HTTPSender; 
     import org.apache.axis.transport.http.HTTPTransport; 

     EngineConfiguration createClientConfig() 
       SimpleProvider clientConfig=new SimpleProvider(); 
       Handler sessionHandler=(Handler)new SimpleSessionHandler(); 
       SimpleChain reqHandler=new SimpleChain(); 
       SimpleChain respHandler=new SimpleChain(); 
       Handler pivot=(Handler)new HTTPSender(); 
       Handler transport=new SimpleTargetedChain(reqHandler, pivot, respHandler); 

       return clientConfig;    
When using {{{WSDL2Java-generated code}}}, the {{{ XYServiceLocator }}} (that extends Service)
does not provide a constructor to give the configuration. If you do not want to modify generated
code, you can work around this the following way: 

       EngineConfiguration clientConfig=getClientConfig(); 
       ["XYServiceLocator"] service=new ["XYServiceLocator"](); 
       service.setEngine(new AxisClient(clientConfig)); 
       XY myservice=service.getmyservice(); 

View raw message