You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by jim <ji...@landoloons.com> on 2010/09/16 02:29:24 UTC

cookie header

  Can anyone give me a working example of how, when using the 
auto-generated ADB stubs, to set a cookie header in the HTTP request?
I find various examples but none seem to work.

I get a cookie set on my initial service call, then need to include it 
on subsequent requests.  I've tried the set-manage-session route but 
that seems not to do anything, the received cookie is neither set 
locally, nor used on subsequent calls.  I have doubts that session 
support is actually in Axis2C.   Alternatively I've tried creating a 
cookie header and setting it in the stub/service client options; this 
also seems to do nothing.    If the support is actually there, maybe I 
just need the right syntax for creating a header, setting a property etc.

Thanks all,

Jim Hughes

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


Re: cookie header

Posted by jim <ji...@landoloons.com>.
  We are now using 1.7.0.  I found a thread in the mail list archive 
from June of this year with the subject "Http cookies".  I followed the 
suggestions in that thread, to explicity attach an http cookie header to 
a request, via the stub options.  Here is my code:

     char achCookie[4096];
     sprintf(achCookie, ".RDCS_DEV03=%s", m_cookie);
     axis2_http_header_t *header = axis2_http_header_create(m_env,     
AXIS2_HTTP_HEADER_COOKIE, achCookie);
     axutil_array_list_t *header_list = axutil_array_list_create(m_env, 2);
     axutil_array_list_add(header_list, m_env, (void *) header);
     axutil_property_t *header_property = axutil_property_create(m_env);
     axis2_options_t *options = axis2_stub_get_options( 
m_IDAServicePort, m_env);     // m_IDAServicePort is the stub
     axutil_property_set_value(header_property, m_env, header_list);
     axutil_property_set_free_func(header_property, m_env, 
axutil_array_list_free_void_arg);
     axis2_options_set_property(options, m_env,    
AXIS2_TRANSPORT_HEADER_PROPERTY, header_property);

I then issue a request through this stub, and capture the HTTP using 
TCPMON.  My cookie header does not appear in the http headers:

     POST /rdcsservice/idawebservice.asmx HTTP/1.1
     Host: dev03.rdcselect.com:8080
     User-Agent: Axis2C/1.7.0
     SOAPAction: "www.JaguarSoftware.com:IDA:data:v1.3:initializeClientIn"
     Content-Type: text/xml;charset=UTF-8
     Content-Length: 293

<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>É  
etc.


I looked at the client/session example in 1.7.0 but did not see anything 
that needs to be done, on the client, in terms of code or configuration 
in order to get session cookie support; it seems it's now built in to 
axis2 and should happen on its own.   I have not bee n able to find a 
way to get axis2c to manage the session cookie itself, or to let me 
attach it manually.  I've seen other examples that use the 'message 
context' to attempt to add a cookie.  Is that the correct path?





On 9/17/2010 7:28 AM, Damitha Kumarage wrote:
> jim wrote:
>>  Can anyone give me a working example of how, when using the 
>> auto-generated ADB stubs, to set a cookie header in the HTTP request?
>> I find various examples but none seem to work.
>>
>> I get a cookie set on my initial service call, then need to include 
>> it on subsequent requests.  I've tried the set-manage-session route 
>> but that seems not to do anything, the received cookie is neither set 
>> locally, nor used on subsequent calls.  I have doubts that session 
>> support is actually in Axis2C.   Alternatively I've tried creating a 
>> cookie header and setting it in the stub/service client options; this 
>> also seems to do nothing.    If the support is actually there, maybe 
>> I just need the right syntax for creating a header, setting a 
>> property etc.
> Please have a look at the mail thread called http cookies in the axis2 
> user list some months before. Also have a look the readme text in the 
> session server/cient samples in 1.7.0 rc2. If not this working please 
> send a detailed explanation of your scenario.
> Thanks,
> Damitha
>>
>> Thanks all,
>>
>> Jim Hughes
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: c-user-help@axis.apache.org
>>
>>
>
>


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


Re: cookie header

Posted by Damitha Kumarage <da...@wso2.com>.
jim wrote:
>  Can anyone give me a working example of how, when using the 
> auto-generated ADB stubs, to set a cookie header in the HTTP request?
> I find various examples but none seem to work.
>
> I get a cookie set on my initial service call, then need to include it 
> on subsequent requests.  I've tried the set-manage-session route but 
> that seems not to do anything, the received cookie is neither set 
> locally, nor used on subsequent calls.  I have doubts that session 
> support is actually in Axis2C.   Alternatively I've tried creating a 
> cookie header and setting it in the stub/service client options; this 
> also seems to do nothing.    If the support is actually there, maybe I 
> just need the right syntax for creating a header, setting a property etc.
Please have a look at the mail thread called http cookies in the axis2 
user list some months before. Also have a look the readme text in the 
session server/cient samples in 1.7.0 rc2. If not this working please 
send a detailed explanation of your scenario.
Thanks,
Damitha
>
> Thanks all,
>
> Jim Hughes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-user-help@axis.apache.org
>
>


-- 
__________________________________________________________________

Damitha Kumarage
Technical Lead; WSO2 Inc.
"Oxygenating the Web Service Platform; " http://www.wso2.com/

blog: " http://damithakumarage.wordpress.com/
__________________________________________________________________

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