cancel
Showing results for 
Search instead for 
Did you mean: 

cookie based authentication for web service within web dynpo

Former Member
0 Kudos

Hi there,

within our web dynpro we want to use a web service, which needs a LTPA-Token (a cookie) as authentication. This cookie is available through the HTTPRequest. However I can't find out how to forward this cookie to the web service.

Do you have an idea

Thanks a lot and regards

Stephan

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Stephan

Try this code

HttpServletRequest req =((com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();

Cookie[] cookies = req.getCookies();

for ( int i=0; i<cookies.length; i++) {

wdComponentAPI.getMessageManager().reportSuccess(cookies<i>.getName());

wdComponentAPI.getMessageManager().reportSuccess(cookies<i>.getValue());

}

Kishore

Former Member
0 Kudos

Hi Stephan

Can you tell us where you are getting this cookie from. Moreover is your WebDynpro running within the portal.

If it is a URL parameter you can use the WDWebContextAdapter to get the values.

For reading cookies i dont think there is any standard WebDynpro API. You will have to read it using the Cookie class which is not a part of Webdynpro standard API.

Check this link on how to read a cookie.

http://help.sap.com/saphelp_nw04/helpdata/en/5b/ac1a0a8b8d6b4da3b79a7fe0aeabd8/frameset.htm

Hope that helps you.

regards

ravi

Former Member
0 Kudos

Hi Stephan,

What is this LTPA-Token ticket? This ticket is coming from other application to your webdynpro application?

I suggest you to use SAP logon ticket. Using SAP logon ticket you can resolve your problem.

Regards,

Bhavik