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 mieke <mm...@zag.com> on 2009/06/23 20:30:20 UTC

HTTP Header issue

I have an old axis2 client with generated stubs that is now required to pass
some additional information in the HTTP Header.  I attempted to modify the
generated stub by adding the following logic to one of the methods:

Hashtable headerTbl = (Hashtable)
_messageContext.getProperty(HTTPConstants.HEADER_SOAP_ACTION);
            if (headerTbl == null) {
                headerTbl = new Hashtable();
                _messageContext.setProperty(HTTPConstants.REQUEST_HEADERS,
headerTbl);
            }
            headerTbl.put("TEST_NAME", "TEST_VALUE");

This did not work.  Could someone please outline (with an example if
possible) how to add data to the header.

Thanks,

Mieke

-- 
View this message in context: http://www.nabble.com/HTTP-Header-issue-tp24169983p24169983.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: HTTP Header issue

Posted by "J. Hondius" <jh...@rem.nl>.
Getting a header like this.
If im not mistaking, there is a 
javax.servlet.http.HttpServletResponse.setHeader(sometype foo) too.
------------------------

import org.apache.axis2.context.MessageContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

MessageContext inMsgCtx = MessageContext.getCurrentMessageContext();
httpServReq   = 
(HttpServletRequest)inMsgCtx.getProperty("transport.http.servletRequest");
httpServResp = 
(HttpServletResponse)inMsgCtx.getProperty("transport.http.servletResponse");
vHost = httpServReq.getHeader("Host");

Greetings, Joek Hondius

mieke schreef:
> I tried the following with out success too
>
>             Hashtable headerTbl = (Hashtable)
> _messageContext.getProperty(HTTPConstants.HTTP_HEADERS);
>
>             if (headerTbl == null) {
>                 headerTbl = new Hashtable();
>                 _messageContext.setProperty(HTTPConstants.HTTP_HEADERS,
> headerTbl);
>             }
>             headerTbl.put("TEST_HEADER", "TEST_VALUE");
>
>
>
> mieke wrote:
>   
>> I have an old axis2 client with generated stubs that is now required to
>> pass some additional information in the HTTP Header.  I attempted to
>> modify the generated stub by adding the following logic to one of the
>> methods:
>>
>> Hashtable headerTbl = (Hashtable)
>> _messageContext.getProperty(HTTPConstants.HEADER_SOAP_ACTION);
>>             if (headerTbl == null) {
>>                 headerTbl = new Hashtable();
>>                 _messageContext.setProperty(HTTPConstants.REQUEST_HEADERS,
>> headerTbl);
>>             }
>>             headerTbl.put("TEST_NAME", "TEST_VALUE");
>>
>> This did not work.  Could someone please outline (with an example if
>> possible) how to add data to the header.
>>
>> Thanks,
>>
>> Mieke
>>
>>
>>     
>
>   

Re: HTTP Header issue

Posted by mieke <mm...@zag.com>.

I tried the following with out success too

            Hashtable headerTbl = (Hashtable)
_messageContext.getProperty(HTTPConstants.HTTP_HEADERS);

            if (headerTbl == null) {
                headerTbl = new Hashtable();
                _messageContext.setProperty(HTTPConstants.HTTP_HEADERS,
headerTbl);
            }
            headerTbl.put("TEST_HEADER", "TEST_VALUE");



mieke wrote:
> 
> I have an old axis2 client with generated stubs that is now required to
> pass some additional information in the HTTP Header.  I attempted to
> modify the generated stub by adding the following logic to one of the
> methods:
> 
> Hashtable headerTbl = (Hashtable)
> _messageContext.getProperty(HTTPConstants.HEADER_SOAP_ACTION);
>             if (headerTbl == null) {
>                 headerTbl = new Hashtable();
>                 _messageContext.setProperty(HTTPConstants.REQUEST_HEADERS,
> headerTbl);
>             }
>             headerTbl.put("TEST_NAME", "TEST_VALUE");
> 
> This did not work.  Could someone please outline (with an example if
> possible) how to add data to the header.
> 
> Thanks,
> 
> Mieke
> 
> 

-- 
View this message in context: http://www.nabble.com/HTTP-Header-issue-tp24169983p24176647.html
Sent from the Axis - User mailing list archive at Nabble.com.