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 Golam Chowdhury <Go...@fieldworker.com> on 2007/09/25 18:25:07 UTC

AXIS2 session create, access, and invalidate

Hi,

I have created a web service that will verify the user and once the user is
verified I will give the user some requested data.


Problem:

-Like to know how to create a session in the server side to store
authentication information. 
-Like to know how to get the session in the server side in order to get the
authentication information.


What I would like to do:

-Once the user is verified, I would like to create a session and store the
authentication information in the session. 
-Once the user request for more data, I would like to use the session to
verify if the user is valid. 
-Once I give the requested data, I would like to invalidate the session so
the user have to re-login.


Any pointer is greatly appreciated.

Thanks
Golam
 



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


Re: AXIS2 session create, access, and invalidate

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
You can access the MessageContext from your service implementation as follows.
   MessageContext incomingContext = MessageContext.getCurrentMessageContext();

You can get the ServiceContext from it[1].. Then you can use
setProperty[2] to store a name value pair in the session. You can
access them using getProperty.

I don't think you'll need to use the init() and destroy() methods.

thanks,
Thilina

[1] http://ws.apache.org/axis2/1_3/api/org/apache/axis2/context/MessageContext.html#getServiceContext()
[2] http://ws.apache.org/axis2/1_3/api/org/apache/axis2/context/AbstractContext.html#setProperty(java.lang.String,%20java.lang.Object)

On 9/26/07, Golam Chowdhury <Go...@fieldworker.com> wrote:
> Thanks Thilina for your reply,
>
> Wondering, if you could give me some example.
>
> I know to enable the session I have to add the <service name="foo" scope="
> transportsession"> </service>" in the service.xml
>
>
>
> ??? using serviceContext how do I access the session and store information
> in the session.
>
> public void init(ServiceContext serviceContext) {
>
> }
>
> public void destroy(ServiceContext serviceContext) {
> }
>
> Thanks very much for all your help.
>
> Golam
>
> -----Original Message-----
> From: Thilina Gunarathne [mailto:csethil@gmail.com]
> Sent: Tuesday, September 25, 2007 7:33 PM
> To: axis-user@ws.apache.org
> Subject: Re: AXIS2 session create, access, and invalidate
>
> Hi,
> You will need to use something like Axis2 transport sessions or SOAP
> session (which requires ws-addressing support in the client side)..
> Then you can store your authentication data in the Axis2
> ServiceContext object.
>
> Following article will give you more information about Axis2 sessions.
> http://www.developer.com/java/web/article.php/3620661
>
> thanks,
> Thilina
>
> On 9/25/07, Golam Chowdhury <Go...@fieldworker.com> wrote:
> > Hi,
> >
> > I have created a web service that will verify the user and once the user
> is
> > verified I will give the user some requested data.
> >
> >
> > Problem:
> >
> > -Like to know how to create a session in the server side to store
> > authentication information.
> > -Like to know how to get the session in the server side in order to get
> the
> > authentication information.
> >
> >
> > What I would like to do:
> >
> > -Once the user is verified, I would like to create a session and store the
> > authentication information in the session.
> > -Once the user request for more data, I would like to use the session to
> > verify if the user is valid.
> > -Once I give the requested data, I would like to invalidate the session so
> > the user have to re-login.
> >
> >
> > Any pointer is greatly appreciated.
> >
> > Thanks
> > Golam
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Thilina Gunarathne  - http://thilinag.blogspot.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

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


RE: AXIS2 session create, access, and invalidate

Posted by Golam Chowdhury <Go...@fieldworker.com>.
Thanks Thilina for your reply,

Wondering, if you could give me some example.

I know to enable the session I have to add the <service name="foo" scope="
transportsession"> </service>" in the service.xml



??? using serviceContext how do I access the session and store information
in the session.

public void init(ServiceContext serviceContext) {
	
}

public void destroy(ServiceContext serviceContext) {
}

Thanks very much for all your help.

Golam

-----Original Message-----
From: Thilina Gunarathne [mailto:csethil@gmail.com] 
Sent: Tuesday, September 25, 2007 7:33 PM
To: axis-user@ws.apache.org
Subject: Re: AXIS2 session create, access, and invalidate

Hi,
You will need to use something like Axis2 transport sessions or SOAP
session (which requires ws-addressing support in the client side)..
Then you can store your authentication data in the Axis2
ServiceContext object.

Following article will give you more information about Axis2 sessions.
http://www.developer.com/java/web/article.php/3620661

thanks,
Thilina

On 9/25/07, Golam Chowdhury <Go...@fieldworker.com> wrote:
> Hi,
>
> I have created a web service that will verify the user and once the user
is
> verified I will give the user some requested data.
>
>
> Problem:
>
> -Like to know how to create a session in the server side to store
> authentication information.
> -Like to know how to get the session in the server side in order to get
the
> authentication information.
>
>
> What I would like to do:
>
> -Once the user is verified, I would like to create a session and store the
> authentication information in the session.
> -Once the user request for more data, I would like to use the session to
> verify if the user is valid.
> -Once I give the requested data, I would like to invalidate the session so
> the user have to re-login.
>
>
> Any pointer is greatly appreciated.
>
> Thanks
> Golam
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

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


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


Re: AXIS2 session create, access, and invalidate

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
You will need to use something like Axis2 transport sessions or SOAP
session (which requires ws-addressing support in the client side)..
Then you can store your authentication data in the Axis2
ServiceContext object.

Following article will give you more information about Axis2 sessions.
http://www.developer.com/java/web/article.php/3620661

thanks,
Thilina

On 9/25/07, Golam Chowdhury <Go...@fieldworker.com> wrote:
> Hi,
>
> I have created a web service that will verify the user and once the user is
> verified I will give the user some requested data.
>
>
> Problem:
>
> -Like to know how to create a session in the server side to store
> authentication information.
> -Like to know how to get the session in the server side in order to get the
> authentication information.
>
>
> What I would like to do:
>
> -Once the user is verified, I would like to create a session and store the
> authentication information in the session.
> -Once the user request for more data, I would like to use the session to
> verify if the user is valid.
> -Once I give the requested data, I would like to invalidate the session so
> the user have to re-login.
>
>
> Any pointer is greatly appreciated.
>
> Thanks
> Golam
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

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