Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by CyrilleLeClerc:
http://wiki.apache.org/ws/FrontPage/Axis/SessionSupport

The comment on the change is:
Add "Q: How can I read the session cookie ?"

------------------------------------------------------------------------------
  
    ''The Profile recommends that cookies not be required by instances for 
proper operation; they should be a hint, to be used for optimization, without 
materially affecting the execution of the Web service. However, they may be 
required in legacy integration and other exceptional use cases, so requiring 
them does not make an instance non-conformant. While Cookies thus may have 
meaning to the instance, they should not be used as an out-of-bound data 
channel between the instance and the consumer. Therefore, interpretation of 
Cookies is not allowed at all by the consumer - it is required to treat them as 
opaque (i.e., have no meaning to the consumer).''
  
+ 
+ '''Q: How can I read the session cookie ?'''
+ 
+ Http Cookies are hold after the invocation by the {{{MessageContext}}} 
properties {{{HTTPConstants.HEADER_COOKIE}}} and 
{{{HTTPConstants.HEADER_COOKIE2}}}. 
+ 
+ Sample to display the cookies :
+ {{{
+ // Enable client side session
+ binding.setMaintainSession(true);
+ 
+ // Invoke service
+ binding.aMethod();
+ 
+ // Read Cookies
+ MessageContext messageContext = binding._getCall().getMessageContext();
+ String cookie1 = (String) 
messageContext.getProperty(HTTPConstants.HEADER_COOKIE);
+ String cookie2 = (String) 
messageContext.getProperty(HTTPConstants.HEADER_COOKIE2);
+ System.out.println("cookie1 : '" + cookie1 + "'");
+ System.out.println("cookie2 : '" + cookie2 + "'");
+ }}}
+ 
+ Sample of result :
+ {{{
+ cookie1 : 'JSESSIONID=FEC9990323740BFD0FECF965F1BCC09A'
+ cookie2 : 'null'
+ }}}
  
  '''Sample of client side sessions'''
  

Reply via email to