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 santhosh kotte <sa...@yahoo.com> on 2009/12/21 18:52:04 UTC

Axis2--How to access custom http headers from axis2 client

Hi guyz...

I have added my own http headers in the axis service.

MessageContext rmc =MessageContext.getCurrentMessageContext().getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
      List<Header> headers = new ArrayList();  
      headers.add(new Header("http_header1","value1"));
      headers.add(new Header("http_header2","value2"));
      rmc.setProperty(HTTPConstants.HTTP_HEADERS, headers);

I could see them through tcpmon in the response .

But I need a way to access these in client code.

Is there a way to do it?



      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

Re: Axis2--How to access custom http headers from axis2 client

Posted by Amila Suriarachchi <am...@gmail.com>.
On Mon, Dec 21, 2009 at 11:22 PM, santhosh kotte <sa...@yahoo.com>wrote:

> Hi guyz...
>
> I have added my own http headers in the axis service.
>
> MessageContext rmc
> =MessageContext.getCurrentMessageContext().getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
>       List<Header> headers = new ArrayList();
>       headers.add(new Header("http_header1","value1"));
>       headers.add(new Header("http_header2","value2"));
>       rmc.setProperty(HTTPConstants.HTTP_HEADERS, headers);
>

axis2 sets the transport headers like this.
msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, transportHeaders);

try to get the values back from this property

have a look at here[1] too.

thanks,
Amila.

[1]
http://amilachinthaka.blogspot.com/2008/11/accessing-axis2-information-at-client.html

>
> I could see them through tcpmon in the response .
>
> But I need a way to access these in client code.
>
> Is there a way to do it?
>
> ------------------------------
> The INTERNET now has a personality. YOURS! See your Yahoo! Homepage<http://in.rd.yahoo.com/tagline_yyi_1/*http://in.yahoo.com/>
> .
>



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