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 Cencio1980 <ce...@gmail.com> on 2007/02/27 19:33:42 UTC

[AXIS2] Echo ws with headers

Hi,

i'm trying to make a simple echo ws in axis2, but i loose soap headers in
the response message.

Now i'm trying to copy headers from request message to response message with
an handler in the out pipe, but i have to iterate on each header and add it
one by one and i'd like to avoid this method.

I do this in the out pipe because response message context is null in
service and avaiable only in the out pipe.. why?

Some1 can help me?

thx!

Re: [AXIS2] Echo ws with headers

Posted by Thilina Gunarathne <cs...@gmail.com>.
You can get this done by putting a custom written handler in to the
outflow.. This guide[1] will help you out..

Thilina
[1] http://ws.apache.org/axis2/1_1_1/modules.html


On 2/28/07, keith chapman <ke...@gmail.com> wrote:
> If you try  getCurrentMessageContext() from the skeleton what you get is the
> incoming messageContext. In order to add custom headers to the response you
> should be adding it to the outgoing messageContext. The envelop is added to
> the outgoing messageContext inside the messageReceiver, which means you will
> have to hack the MR in order to add the header.
>
> Thanks,
> Keith.
>
>
> On 2/28/07, Lorenzo <ce...@gmail.com> wrote:
> > thx, but which context i should use?
> >
> > this:
> >   opContext.getMessageContext(
> WSDLConstants.MESSAGE_LABEL_IN_VALUE )
> > and this:
> >   getCurrentMessageContext()
> > return the incoming MessageContext;
> >
> > this one:
> >   opContext.getMessageContext(
> WSDLConstants.MESSAGE_LABEL_OUT_VALUE );
> > returns the outgoing MessageContext, but only in the out pipe, in the
> > service return NULL...
> >
> > And again, which is the easiest and lighter way to clone incoming
> > message parts in the outgoing message?
> >
> > Thx again..
> >
> > On mer, 2007-02-28 at 10:18 +0530, keith chapman wrote:
> > > R you trying to add cusom SOAP headers to the response message? If so
> > > you can try the following in the message Receiver.
> > >
> > > // Create a SOAPHeader block
> > > SOAPHeaderBlock soapHeader =
> soapFactory.createSOAPHeaderBlock ();
> > >
> > > // Add the SOAP header to the envelop
> > >
> msgContext.getEnvelope.getHeader().addChild(soapHeader);
> > >
> > > Hope this might help.
> > >
> > > Thanks,
> > > Keith
> > >
> > > On 2/28/07, Cencio1980 <ce...@gmail.com> wrote:
> > >         Hi,
> > >
> > >         i'm trying to make a simple echo ws in axis2, but i loose soap
> > >         headers in the response message.
> > >
> > >         Now i'm trying to copy headers from request message to
> > >         response message with an handler in the out pipe, but i have
> > >         to iterate on each header and add it one by one and i'd like
> > >         to avoid this method.
> > >
> > >         I do this in the out pipe because response message context is
> > >         null in service and avaiable only in the out pipe.. why?
> > >
> > >         Some1 can help me?
> > >
> > >         thx!
> > >
> > >
> > >
> > > --
> > > Keith Chapman
> > > WSO2 Inc.
> > > Oxygen for Web Services Developers.
> > > http://wso2.org/
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
>
> --
> Keith Chapman
> WSO2 Inc.
> Oxygen for Web Services Developers.
> http://wso2.org/


-- 
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/

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


Re: [AXIS2] Echo ws with headers

Posted by keith chapman <ke...@gmail.com>.
If you try  getCurrentMessageContext() from the skeleton what you get is the
incoming messageContext. In order to add custom headers to the response you
should be adding it to the outgoing messageContext. The envelop is added to
the outgoing messageContext inside the messageReceiver, which means you will
have to hack the MR in order to add the header.

Thanks,
Keith.

On 2/28/07, Lorenzo <ce...@gmail.com> wrote:
>
> thx, but which context i should use?
>
> this:
>   opContext.getMessageContext( WSDLConstants.MESSAGE_LABEL_IN_VALUE )
> and this:
>   getCurrentMessageContext()
> return the incoming MessageContext;
>
> this one:
>   opContext.getMessageContext( WSDLConstants.MESSAGE_LABEL_OUT_VALUE );
> returns the outgoing MessageContext, but only in the out pipe, in the
> service return NULL...
>
> And again, which is the easiest and lighter way to clone incoming
> message parts in the outgoing message?
>
> Thx again..
>
> On mer, 2007-02-28 at 10:18 +0530, keith chapman wrote:
> > R you trying to add cusom SOAP headers to the response message? If so
> > you can try the following in the message Receiver.
> >
> > // Create a SOAPHeader block
> > SOAPHeaderBlock soapHeader = soapFactory.createSOAPHeaderBlock ();
> >
> > // Add the SOAP header to the envelop
> > msgContext.getEnvelope.getHeader().addChild(soapHeader);
> >
> > Hope this might help.
> >
> > Thanks,
> > Keith
> >
> > On 2/28/07, Cencio1980 <ce...@gmail.com> wrote:
> >         Hi,
> >
> >         i'm trying to make a simple echo ws in axis2, but i loose soap
> >         headers in the response message.
> >
> >         Now i'm trying to copy headers from request message to
> >         response message with an handler in the out pipe, but i have
> >         to iterate on each header and add it one by one and i'd like
> >         to avoid this method.
> >
> >         I do this in the out pipe because response message context is
> >         null in service and avaiable only in the out pipe.. why?
> >
> >         Some1 can help me?
> >
> >         thx!
> >
> >
> >
> > --
> > Keith Chapman
> > WSO2 Inc.
> > Oxygen for Web Services Developers.
> > http://wso2.org/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/

Re: [AXIS2] Echo ws with headers

Posted by Lorenzo <ce...@gmail.com>.
thx, but which context i should use?

this:
  opContext.getMessageContext( WSDLConstants.MESSAGE_LABEL_IN_VALUE )
and this:
  getCurrentMessageContext()
return the incoming MessageContext;

this one:   
  opContext.getMessageContext( WSDLConstants.MESSAGE_LABEL_OUT_VALUE );
returns the outgoing MessageContext, but only in the out pipe, in the
service return NULL...

And again, which is the easiest and lighter way to clone incoming
message parts in the outgoing message?

Thx again..

On mer, 2007-02-28 at 10:18 +0530, keith chapman wrote:
> R you trying to add cusom SOAP headers to the response message? If so
> you can try the following in the message Receiver.
> 
> // Create a SOAPHeader block
> SOAPHeaderBlock soapHeader = soapFactory.createSOAPHeaderBlock (); 
> 
> // Add the SOAP header to the envelop
> msgContext.getEnvelope.getHeader().addChild(soapHeader);
> 
> Hope this might help.
> 
> Thanks,
> Keith
> 
> On 2/28/07, Cencio1980 <ce...@gmail.com> wrote:
>         Hi,
>          
>         i'm trying to make a simple echo ws in axis2, but i loose soap
>         headers in the response message.
>          
>         Now i'm trying to copy headers from request message to
>         response message with an handler in the out pipe, but i have
>         to iterate on each header and add it one by one and i'd like
>         to avoid this method.
>          
>         I do this in the out pipe because response message context is
>         null in service and avaiable only in the out pipe.. why?
>          
>         Some1 can help me?
>          
>         thx!
> 
> 
> 
> -- 
> Keith Chapman
> WSO2 Inc.
> Oxygen for Web Services Developers.
> http://wso2.org/


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


Re: [AXIS2] Echo ws with headers

Posted by keith chapman <ke...@gmail.com>.
R you trying to add cusom SOAP headers to the response message? If so you
can try the following in the message Receiver.

// Create a SOAPHeader block
SOAPHeaderBlock soapHeader = soapFactory.createSOAPHeaderBlock();

// Add the SOAP header to the envelop
msgContext.getEnvelope.getHeader().addChild(soapHeader);

Hope this might help.

Thanks,
Keith

On 2/28/07, Cencio1980 <ce...@gmail.com> wrote:
>
> Hi,
>
> i'm trying to make a simple echo ws in axis2, but i loose soap headers in
> the response message.
>
> Now i'm trying to copy headers from request message to response message
> with an handler in the out pipe, but i have to iterate on each header and
> add it one by one and i'd like to avoid this method.
>
> I do this in the out pipe because response message context is null in
> service and avaiable only in the out pipe.. why?
>
> Some1 can help me?
>
> thx!
>



-- 
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/