cancel
Showing results for 
Search instead for 
Did you mean: 

Session object in webdynpro

Former Member
0 Kudos

Hi all,

In PDK we can track session using IPortalComponentrequest and httpsession. How do i implement the same for getting the session object in webdynpro.

My requirement is when a user logs in, his session is tracked and certain details get stored through the session object.When other applications require those details, they can access the same using the session object.

Lookin forward for some useful pointers

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

To get all client session names, use this

for(int i=0;i<WDServerState.getActualClientSessions().length;i++)

{

msgMngr.reportWarning("Session "+WDServerState.getActualClientSessions()<i>);

}

Regards

Fahad Hamsa

Former Member
0 Kudos

hi Fahad

How can I use this for getting and setting data?

Former Member
0 Kudos

Hi Fahad

When I use WDServerState.getActualClientSessions() it returns me two different values on running the application. Could you please explain?

Thanks

Answers (4)

Answers (4)

Former Member
0 Kudos

wdScopeUtil is helpful in passing data. It can be used instead of scope

Former Member
0 Kudos

Hi Priyanka,

Do you set value in Portal and read it from WebDynpro?

I have a situation here...

I want to open a Portal iView from WebDynpro do some processing and set some value in session or whatever and need to read these values somehow from WebDynpro.

I see that even though they give the same values if I get the session ID from Portal and WebDynpro, I'm not able to get the value that I set in session in Portal from WebDynpro...

Is there a way?

Thanks

JP

Former Member
0 Kudos

Hi JP,

My requirement was to read some data stored in the session object by some component by other components. If this is somewhat similar to your requirement, you can use the wdScopeUtil and its methods get() and put(). I was perfectly able to get the values stored in it using put across different webdynpro components. Do communicate if I got your problem right!!!

Former Member
0 Kudos

Hi Priyanka,

My requirement is quite different. I have the requirement of sharing data between Portal iView and a WebDynpro iView...They both run on the same Java Runtime/J2EE server.

When I get the sessionID from both, I'm able to get the same sessionID, but the data set in one (Portal iView) does not come in the other (WebDynpro App)...

Any idea?

Thanks.

JP

Former Member
0 Kudos

Add this com.sap.ep.applicationdevelopment jar to your application

Former Member
0 Kudos

Hi Priyanka,

Check this code

IScope scope = Utils.getCurrentClientSession().getScope();

in this scope u can set the values u want to pass to other applications like

scope.put("SCOPE_VAR1",scopevar1);

It will be a key value pair.

whereever u want to get the details from scope,

just call:

scope.get("SCOPE_VAR1");

regards

Sumit

Former Member
0 Kudos

Thanks all for ur replies. But I need one more clarification.

Can getActualClientsessios() be used for preserving data values across applications?

By using the scope I would be able to pass data across applications . How do i capture session id using that?

Also, if I want to use IPortalComponentrequest object , which jarshould I import?

Former Member
0 Kudos

Hi Priyanka,

try this

IApplicationSession a =Utils.getCurrentApplicationSession();

a.getApplicationSessionId();

regards

Sumit

Former Member
0 Kudos

Hi Sumit

If I m not wrong, this will capture the application session and not the client session.

Former Member
0 Kudos

Hi Priyanka,

Sorry for that.try this code

IClientSession s =Utils.getCurrentClientSession();

s.getClientSessionID()

regards

Sumit

Former Member
0 Kudos

Thanks Sumit

Former Member
0 Kudos

Hi Sumit,

I went through this thread recently and it says scope is an internal wd class and would not be supported in the future.

Any other alternative to serve the purpose?

Thanks

Former Member
0 Kudos

I am usingwdScopeUtil for passing data.

Former Member
0 Kudos

check the session object attributes in the portal (System administration -> System configuration -> Web Dynpro Console -> About -> Sessions....

go through these links....