axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepal Jayasinghe <dee...@opensource.lk>
Subject Re: [Axis2] Can I declare a handler in service.xml?
Date Mon, 08 May 2006 04:09:40 GMT
Hi Laszlo;
It is by design we are not allow user to add handlers in services.xml,
in fact adding a handler is always done using a module. So as you said
you have to have a module with that handler.

You can configure handler using service , at the runtime when handler
ask for a parameter from the message context , it will first look in
AxisOperation , and then AxisService , next AxisServiceGroup etc...
So to solve your problem you can do smt like following;
  1. Create a module with that handler
  2. And set the phase of the handler as Dispatch (it will be good that
if you set that as phase last handler)
  3. Add those two parameters into services.xml ,
  4. When handler execute try to get those parameters and evaluate the
condition
  5. So depending on the result you can change the AxisOperation.



Laszlo Czegledi wrote:

> Hi,
>
> In Axis2 I am trying to configure a handler, which looks into the
> message content, then set the appropriate operation. The criteria of
> the selection is unique for each service. For example:
>
> <service name="MyService">
>    <parameter name="ServiceClass"
> locked="false">userguide.example1.MyService</parameter>
>    <operation name="echo">
>        <messageReceiver
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>        <actionMapping>urn:echo</actionMapping>
>    </operation>
>    <operation name="ping">
>        <messageReceiver
> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>        <actionMapping>urn:ping</actionMapping>
>    </operation>
>      <handler name="opSelectorHandler"
> class="userguide.example1.OperationSelectorHandler">
>      <order phase="OperationInPhase" />
>      <parameter name="condition1" locked="false">expression1</parameter>
>      <parameter name="condition2" locked="false">expression2</parameter>
>    </handler>
> </service>
>
> If expression1 evaluates to true then I would set the operation to
> 'echo', otherwise to 'ping'.
> My problem is that it seems to me that I can not declare a handler in
> a service descriptor file, only in a module descriptor. (Is this
> true?) But in that case I can not customize the handler per service.
>
> Any idea?
>
> Regards,
> Laszlo
>
>
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 



Mime
View raw message