Hi Rodrigo, is it really that complicated to include a handler? Within server-config.wsdd, it's just a single line to include the (example) LogHandler, why is it so complicated to inject it via API?
As a resumee, this is what I want to do: - add a Handler to Message Processing. Nothing complicated. Complexity similar to the org.apache.axis.handlers.LogHandler provided by Axis. - do this in client and server - within the server, this is easy using <handler>-Tags in server-config.wsdd, because the handler is needed always. This works already. - within the client, client-config.wsdd is inappropriate, because the handler isn't used on every run of the client. - How is it possible to inject a (simple) Handler via Java Calls the way it would be in client-config.wsdd or server-config.wsdd. As an example, I'm still trying to use the LogHandler provided by Axis (which extends org.apache.axis.handlers.BaseHandler, which itself implements org.apache.axis.Handler (which does only extend Serializable, and no javax.rpc-Interface). I thought this must be a very simple thing to do. What you wrote sounds profound but is very complicated for a (in my eyes) simple thing: adding a Handler to message Processing. ... hoping for an answer ... :) CU Werner > -----Original Message----- > From: Rodrigo Ruiz [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 04, 2006 11:06 AM > To: [email protected] > Subject: Re: Adding own handler in Java Code? > > Hi Jansen, > > Ideally you should be able to create a custom chain and deploy it in > your client-config.wsdd as an actual chain. Unfortunately, Axis WSDD > syntax does not allow to deploy custom chains. When you put a <chain> > tag, it always creates a SimpleChain instance. > > I would create a JIRA report to ask for the ability to specify a > different class name for the Chain implementation. Something > similar to > the type attribute for handlers. > > In the meantime, you could try to write your own custom chain > and deploy > it as any other regular handler. Your chain would allow you > to configure > the list of handlers to be included, *before* performing the call, > through the MessageContext, or any other appropriate channel. If I am > not wrong, setting a property on the service client stub makes it > available from the MessageContext during handlers invocation. > > Configuring the handlers within your custom chain should be straight > forward once the WSDD syntax is extended. With the current syntax you > have two options: > > 1. Use a secondary WSDD file with the contained handler > configurations > and parse it from your chain init() method. > > 2. Define all your handlers in your wsdd configuration file > with unique > names, set a property for your chain containing a list of > handler names, > and obtain the handler instances from the init() method. > > Instead of adding/removing handlers, it is easier to enable/disable > them. This way, you can initialise all the handlers once, and specify > its ordering at configuration time. At runtime you will just have to > supply a list(or set) of the handlers that must be enabled for a call. > > I attach a simple template class that may be of help. It > implements the > second option mentioned above. > > Regards, > Rodrigo Ruiz > > Jansen Werner wrote: > > Thanks for you reply! > > > >> -----Original Message----- > >> From: Rodrigo Ruiz [mailto:[EMAIL PROTECTED] > >> Sent: Monday, July 03, 2006 3:57 PM > >> To: [email protected] > >> Subject: Re: Adding own handler in Java Code? > >> > >> Hi Jansen, > >> > >> The answer depends on what you mean be "add dynamically". :-) > >> > >> If you mean "add a jar at runtime and have it automatically > >> recognized", > >> the answer is that it is very hard. You will need Axis 2 > to have this > >> feature built in, or implement yourself a dynamic > >> class-loader like the > >> one used by Axis 2, and a handler with the ability to detect > >> the changes > >> at runtime, and call these "dynamic" handlers when appropriate. > > > > No, I'm lucky, this is not what I meant :) > > > > > >> If you mean "selecting a subset among an already well-known set of > >> available handlers", the answer is that it is easier :-) > >> > >> You will have to create a handler that could act as a > >> "handler chain", > >> and put into it the logic to take the decision about what > handlers to > >> actually call when invoked. Depending on what you need, > this handler > >> will have the information needed to find out the handlers to > >> call (for > >> example, by parsing a policy), or you may have to include the > >> mechanisms > >> to communicate with it from the service implementations or > >> other points, > >> and configure it at runtime. > > > > OK, this sounds like my problem. > > > > For an example, let's take the LogHandler packaged with > axis. How can I > > add this (simple, easy) Handler to Axis at runtime? (And > remove it later > > ...). > > > > I have found a way to access the HandlerRegistry > > (Service.getHandlerRegistry()). But - without deeper > knowledge of the > > HandlerChains available - how do I add my Handler (or the LogHandler > > mentioned above)? > > > >> Just keep in mind that you need to respect the handlers > >> interface, and > >> call their methods in the appropriate order. That is, to > >> initialise them > >> before invoking them, and the like. > > > > This is something I will concentrate on when I managed to add the > > LogHandler provided by Axis :) > > > > Ah, before I forget it again, our Axis version is 1.3 :) > > > > Thanks in advance :) > > > > CU > > Werner > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > ------------------------------------------------------------------- > GRIDSYSTEMS Rodrigo Ruiz Aguayo > Parc Bit - Son Espanyol > 07120 Palma de Mallorca mailto:[EMAIL PROTECTED] > Baleares - EspaƱa Tel:+34-971435085 Fax:+34-971435082 > http://www.gridsystems.com > ------------------------------------------------------------------- > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
