Re: maintain'g session problem

2008-02-27 Thread prakesh kt


Thank u, it is  working for me .


--
Sent using goWebtop from Laszlo Systems.
Try it yourself : http://www.gowebtop.com


On Wed, Feb 27, 2008 at  5:55 PM, Ian Roberts wrote:


prakesh kt wrote:
when ever i am trying to get the values from the session it is giving 
null values.because it is creating the new session for every request. 
please help me to avoid this. I know in axis we can give 
maintainsession(true) to avoid this.


((BindingProvider)clientStub).getRequestContext().put(
  BindingProvider.SESSION_MAINTAIN_PROPERTY,
  Boolean.TRUE);

I got this from a Metro blog entry but it's a JAX-WS thing, not 
specific to Metro, and it works for me with CXF.


Ian

--
Ian Roberts   | Department of Computer Science
[EMAIL PROTECTED]  | University of Sheffield, UK


maintain'g session problem

2008-02-27 Thread prakesh kt

Hi ,

 I am new  to cxf . My services are  successfully exposed  and i wrote 
the client stubs to communicate with my services .currently i am   stuck 
up with  one problem and i am looking for some pointers on this.


 I would like check the  authentication of the user before using my 
services. I  have list of valid user details in my db.


whenever  User trying to  use  my services , I want to check the 
authentication. for this purpuse i am calling a method internally when 
ever the user invoke my service and binding the  username &password  and 
setting it in to the httpSession (please refer the below code). i hope 
that now u understand  the problem, when ever i am trying to get the 
values from the session it is giving null values.because it is creating 
the new session for every request. please help me to avoid this. I know 
in axis we can give maintainsession(true) to avoid this.


(IN my Serviceimpl class)

 @Resource
  WebServiceContext wsc;

@WebMethod
public void isValidUser(String username, String password) {
MessageContext context=wsc.getMessageContext();
HttpServletRequest 
request=(HttpServletRequest)context.get(MessageContext.SERVLET_REQUEST);

/*
 here i am calling some method to check the authentication and 
after puting some flag value in session.

  */
}

 @WebMethod
 public void getMySerivce(String str){
HttpServletRequest 
request=(HttpServletRequest)wsc.getMessageContext().get(MessageContext.SERVLET_REQUEST);
boolean  value=request.getSession().getAttribute("MYFLAG");// 
getting  null. because here i am getting new session instance.


}


thanks,
prakeshkt