You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Igor Nogueira <ig...@gmail.com> on 2008/10/13 01:14:32 UTC

In-flow request insertion

Guys,  I have the following situation: I have a handler inserted on in-flow.
It's phase is located after "postdispatch" phase. On this handler I modify
the message, I mean the SOAPEnvelope and I'd like to re-send it to the
beginning of the in-flow, like a new invocation to the service. Is it
possible to do? If yes, what should I use?

Thanks in advance,

Igor Nogueira

Re: In-flow request insertion

Posted by Igor Nogueira <ig...@gmail.com>.
Hey Martin, Thanks for answering! But I didn't understand. I mean the first
phase of in-flow is "TransportIn" so shouldn't I send the message to this
point, at the beginnig of the flow? How could I define an action there?
Sorry me, but as a newbie at Axis and Java I'm confused ;-)

Thanks again!

Igor

RE: In-flow request insertion

Posted by Martin Gainty <mg...@hotmail.com>.
you have an action thats defined which starts this chain of events ?
so for an example lets call the mapping id is called result1
so by finding the Forward you will find the location that this is mapped to 
return mapping.findForward("result1");


HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


Date: Sun, 12 Oct 2008 21:14:32 -0200
From: igornogueirasantos@gmail.com
To: axis-user@ws.apache.org
Subject: In-flow request insertion

Guys,  I have the following situation: I have a handler inserted on in-flow. It's phase is located after "postdispatch" phase. On this handler I modify the message, I mean the SOAPEnvelope and I'd like to re-send it to the beginning of the in-flow, like a new invocation to the service. Is it possible to do? If yes, what should I use?


Thanks in advance,

Igor Nogueira




_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008

Re: In-flow request insertion

Posted by Igor Nogueira <ig...@gmail.com>.
Is there something I need to rebuild? I mean has something been consumed
during the InFlow that I need to reset?

Regards,

Igor Nogueira

2008/10/13 Igor Nogueira <ig...@gmail.com>

> Amila, thank you! I've tested what you said, but I've got this exception:
> "A message was added that is not valid. However, the operation context was
> complete."
> Here's the code I'm using:
>
>         contextomensagem.setCurrentHandlerIndex(0);
>         contextomensagem.setCurrentPhaseIndex(0);
>         AxisEngine engine = new
> AxisEngine(contextomensagem.getConfigurationContext());
>         try {
>             engine.receive(contextomensagem);
>         } catch (AxisFault e1) {
>
>             e1.printStackTrace();
>             return (e1.getReason());
>         }
>
> "contextomensagem" is a static variable that keeps a copy of the
> MessageContext received at the invoke method. As I'm testing I didin't
> change the SOAPEnvelope, I'm  just trying to re-send the same message. Is
> there something else to do?
>
> Thanks!
>

Re: In-flow request insertion

Posted by Igor Nogueira <ig...@gmail.com>.
> I am not clear about your requirement. But may be looking at Axis2
> clustering would be usefull to you.
>
>
>   Amila, Basically I want to do this: I have several services distributed
on several servers. Only one of them will process client's requests- the
primary one. If the primary fails, then one of the sleeping replicas will be
elected as the new primary and will respond to the client's invocations from
this moment on. My problem is: If the primary fails processing a specific
client's invocation   the new elected primary must be aware of the client's
address in order to process and answer this request. On the next requests
the client will invoke the new functional primary, so there's no problem.
 On clustering used by Axis, all requests are spread to all replicas, ins't
it? In passive replication, only primary receives client's requests while
the replicas sleep. If the primary fails, a replica will be elected new
primary

Thanks!

Re: In-flow request insertion

Posted by Igor Nogueira <ig...@gmail.com>.
Thanks! I'm thinking about invoking the "normal" way from the handler
creating the serviceclient, options etc...But I just need the original's
client's address in order to send the response to the client and not to the
handler, got it? ;-) So on outflow I'd have to change the reply address form
the handler's address to the client's address...


Thank you very much!



2008/10/15 Amila Suriarachchi <am...@gmail.com>

>
>
> On Tue, Oct 14, 2008 at 10:17 PM, Igor Nogueira <
> igornogueirasantos@gmail.com> wrote:
>
>>
>> Actually I want to develop a passive replication schema, so I have the
>> handlers together in a group. If the Active member fails, I'll have to
>> re-invoke the message, but in another handler in another server. I'm
>> serializing the Messagecontext and moving it through the replicas, so when
>> a
>> fault is detected I'll invoke the message again, but in another service .
>> Is
>> there a way to do that?I tryed to use LocalTranportSender, but it returns
>> me
>> a nullexception error...I've opened another thread on the list about
>> it...if
>> you have time, could you take a lokk at it too? ;-)
>
>
> I am not clear about your requirement. But may be looking at Axis2
> clustering would be usefull to you.
>
> thanks,
> Amila.
>
>>
>>
>> Thanks again!!!,
>>
>> Igor Nogueira
>>
>>
>> Amila Suriarachchi wrote:
>> >
>> > On Mon, Oct 13, 2008 at 4:29 PM, Igor Nogueira
>> > <igornogueirasantos@gmail.com
>> >> wrote:
>> >
>> >> Amila, thank you! I've tested what you said, but I've got this
>> exception:
>> >> "A message was added that is not valid. However, the operation context
>> >> was
>> >> complete."
>> >>
>> >
>> > this means it try to add an Axis2 Message to an operation context which
>> > already has required number of Axis2 messages. This may happen when it
>> > goes
>> > through the dispatches again.
>> >
>> >>
>> >> Here's the code I'm using:
>> >>
>> >>         contextomensagem.setCurrentHandlerIndex(0);
>> >>         contextomensagem.setCurrentPhaseIndex(0);
>> >>         AxisEngine engine = new
>> >> AxisEngine(contextomensagem.getConfigurationContext());
>> >>         try {
>> >>             engine.receive(contextomensagem);
>> >>
>> > you can simply called . AxisEngine.receive() since this is a static
>> > method.
>> >
>> >>
>> >>         } catch (AxisFault e1) {
>> >>
>> >>             e1.printStackTrace();
>> >>             return (e1.getReason());
>> >>         }
>> >>
>> >> "contextomensagem" is a static variable that keeps a copy of the
>> >> MessageContext received at the invoke method. As I'm testing I didin't
>> >> change the SOAPEnvelope, I'm  just trying to re-send the same message.
>> Is
>> >> there something else to do?
>> >>
>> >
>> > Are you experimenting with Axis2 Engine or what do you try to archive?
>> why
>> > you want to send the same message twice?
>> >
>> > thanks,
>> > Amila.
>> >
>> >>
>> >>
>> >> Thanks!
>> >>
>> >
>> >
>> >
>> > --
>> > Amila Suriarachchi
>> > WSO2 Inc.
>> > blog: http://amilachinthaka.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/In-flow-request-insertion-tp19946886p19977558.html
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>

Re: In-flow request insertion

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Oct 14, 2008 at 10:17 PM, Igor Nogueira <
igornogueirasantos@gmail.com> wrote:

>
> Actually I want to develop a passive replication schema, so I have the
> handlers together in a group. If the Active member fails, I'll have to
> re-invoke the message, but in another handler in another server. I'm
> serializing the Messagecontext and moving it through the replicas, so when
> a
> fault is detected I'll invoke the message again, but in another service .
> Is
> there a way to do that?I tryed to use LocalTranportSender, but it returns
> me
> a nullexception error...I've opened another thread on the list about
> it...if
> you have time, could you take a lokk at it too? ;-)


I am not clear about your requirement. But may be looking at Axis2
clustering would be usefull to you.

thanks,
Amila.

>
>
> Thanks again!!!,
>
> Igor Nogueira
>
>
> Amila Suriarachchi wrote:
> >
> > On Mon, Oct 13, 2008 at 4:29 PM, Igor Nogueira
> > <igornogueirasantos@gmail.com
> >> wrote:
> >
> >> Amila, thank you! I've tested what you said, but I've got this
> exception:
> >> "A message was added that is not valid. However, the operation context
> >> was
> >> complete."
> >>
> >
> > this means it try to add an Axis2 Message to an operation context which
> > already has required number of Axis2 messages. This may happen when it
> > goes
> > through the dispatches again.
> >
> >>
> >> Here's the code I'm using:
> >>
> >>         contextomensagem.setCurrentHandlerIndex(0);
> >>         contextomensagem.setCurrentPhaseIndex(0);
> >>         AxisEngine engine = new
> >> AxisEngine(contextomensagem.getConfigurationContext());
> >>         try {
> >>             engine.receive(contextomensagem);
> >>
> > you can simply called . AxisEngine.receive() since this is a static
> > method.
> >
> >>
> >>         } catch (AxisFault e1) {
> >>
> >>             e1.printStackTrace();
> >>             return (e1.getReason());
> >>         }
> >>
> >> "contextomensagem" is a static variable that keeps a copy of the
> >> MessageContext received at the invoke method. As I'm testing I didin't
> >> change the SOAPEnvelope, I'm  just trying to re-send the same message.
> Is
> >> there something else to do?
> >>
> >
> > Are you experimenting with Axis2 Engine or what do you try to archive?
> why
> > you want to send the same message twice?
> >
> > thanks,
> > Amila.
> >
> >>
> >>
> >> Thanks!
> >>
> >
> >
> >
> > --
> > Amila Suriarachchi
> > WSO2 Inc.
> > blog: http://amilachinthaka.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/In-flow-request-insertion-tp19946886p19977558.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: In-flow request insertion

Posted by Igor Nogueira <ig...@gmail.com>.
Actually I want to develop a passive replication schema, so I have the
handlers together in a group. If the Active member fails, I'll have to
re-invoke the message, but in another handler in another server. I'm
serializing the Messagecontext and moving it through the replicas, so when a
fault is detected I'll invoke the message again, but in another service . Is
there a way to do that?I tryed to use LocalTranportSender, but it returns me
a nullexception error...I've opened another thread on the list about it...if
you have time, could you take a lokk at it too? ;-)

Thanks again!!!,

Igor Nogueira


Amila Suriarachchi wrote:
> 
> On Mon, Oct 13, 2008 at 4:29 PM, Igor Nogueira
> <igornogueirasantos@gmail.com
>> wrote:
> 
>> Amila, thank you! I've tested what you said, but I've got this exception:
>> "A message was added that is not valid. However, the operation context
>> was
>> complete."
>>
> 
> this means it try to add an Axis2 Message to an operation context which
> already has required number of Axis2 messages. This may happen when it
> goes
> through the dispatches again.
> 
>>
>> Here's the code I'm using:
>>
>>         contextomensagem.setCurrentHandlerIndex(0);
>>         contextomensagem.setCurrentPhaseIndex(0);
>>         AxisEngine engine = new
>> AxisEngine(contextomensagem.getConfigurationContext());
>>         try {
>>             engine.receive(contextomensagem);
>>
> you can simply called . AxisEngine.receive() since this is a static
> method.
> 
>>
>>         } catch (AxisFault e1) {
>>
>>             e1.printStackTrace();
>>             return (e1.getReason());
>>         }
>>
>> "contextomensagem" is a static variable that keeps a copy of the
>> MessageContext received at the invoke method. As I'm testing I didin't
>> change the SOAPEnvelope, I'm  just trying to re-send the same message. Is
>> there something else to do?
>>
> 
> Are you experimenting with Axis2 Engine or what do you try to archive? why
> you want to send the same message twice?
> 
> thanks,
> Amila.
> 
>>
>>
>> Thanks!
>>
> 
> 
> 
> -- 
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/In-flow-request-insertion-tp19946886p19977558.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: In-flow request insertion

Posted by Amila Suriarachchi <am...@gmail.com>.
On Mon, Oct 13, 2008 at 4:29 PM, Igor Nogueira <igornogueirasantos@gmail.com
> wrote:

> Amila, thank you! I've tested what you said, but I've got this exception:
> "A message was added that is not valid. However, the operation context was
> complete."
>

this means it try to add an Axis2 Message to an operation context which
already has required number of Axis2 messages. This may happen when it goes
through the dispatches again.

>
> Here's the code I'm using:
>
>         contextomensagem.setCurrentHandlerIndex(0);
>         contextomensagem.setCurrentPhaseIndex(0);
>         AxisEngine engine = new
> AxisEngine(contextomensagem.getConfigurationContext());
>         try {
>             engine.receive(contextomensagem);
>
you can simply called . AxisEngine.receive() since this is a static method.

>
>         } catch (AxisFault e1) {
>
>             e1.printStackTrace();
>             return (e1.getReason());
>         }
>
> "contextomensagem" is a static variable that keeps a copy of the
> MessageContext received at the invoke method. As I'm testing I didin't
> change the SOAPEnvelope, I'm  just trying to re-send the same message. Is
> there something else to do?
>

Are you experimenting with Axis2 Engine or what do you try to archive? why
you want to send the same message twice?

thanks,
Amila.

>
>
> Thanks!
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: In-flow request insertion

Posted by Igor Nogueira <ig...@gmail.com>.
Amila, thank you! I've tested what you said, but I've got this exception:
"A message was added that is not valid. However, the operation context was
complete."
Here's the code I'm using:

        contextomensagem.setCurrentHandlerIndex(0);
        contextomensagem.setCurrentPhaseIndex(0);
        AxisEngine engine = new
AxisEngine(contextomensagem.getConfigurationContext());
        try {
            engine.receive(contextomensagem);
        } catch (AxisFault e1) {

            e1.printStackTrace();
            return (e1.getReason());
        }

"contextomensagem" is a static variable that keeps a copy of the
MessageContext received at the invoke method. As I'm testing I didin't
change the SOAPEnvelope, I'm  just trying to re-send the same message. Is
there something else to do?

Thanks!

Re: In-flow request insertion

Posted by Amila Suriarachchi <am...@gmail.com>.
On Mon, Oct 13, 2008 at 12:25 PM, Amila Suriarachchi <
amilasuriarachchi@gmail.com> wrote:

>
>
> On Mon, Oct 13, 2008 at 4:44 AM, Igor Nogueira <
> igornogueirasantos@gmail.com> wrote:
>
>> Guys,  I have the following situation: I have a handler inserted on
>> in-flow. It's phase is located after "postdispatch" phase. On this handler I
>> modify the message, I mean the SOAPEnvelope and I'd like to re-send it to
>> the beginning of the in-flow, like a new invocation to the service. Is it
>> possible to do? If yes, what should I use?
>>
>
> try to call
> AxisEngine.send(); with the message context
>
> before calling the AxisEngine.send(): set the
>
Sorry this should be AxisEngine.receive() for in flow and
AxisEngine.send() for out flow.

thanks,
Amila.

>
> currentHandlerInex and currentPhaseIndex to 0 in the message context.
>
> thanks,
> Amila.
>
>>
>>
>> Thanks in advance,
>>
>> Igor Nogueira
>>
>>
>>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: In-flow request insertion

Posted by Amila Suriarachchi <am...@gmail.com>.
On Mon, Oct 13, 2008 at 4:44 AM, Igor Nogueira <igornogueirasantos@gmail.com
> wrote:

> Guys,  I have the following situation: I have a handler inserted on
> in-flow. It's phase is located after "postdispatch" phase. On this handler I
> modify the message, I mean the SOAPEnvelope and I'd like to re-send it to
> the beginning of the in-flow, like a new invocation to the service. Is it
> possible to do? If yes, what should I use?
>

try to call
AxisEngine.send(); with the message context

before calling the AxisEngine.send(): set the
currentHandlerInex and currentPhaseIndex to 0 in the message context.

thanks,
Amila.

>
>
> Thanks in advance,
>
> Igor Nogueira
>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/