cancel
Showing results for 
Search instead for 
Did you mean: 

Cookies in WebDynpro

Former Member
0 Kudos

Hi,

I wanted to get the cookie MYSAPSSO2 through web dynpro. How will i get it?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sujesh,

Try with following code:

serviceImpl service = WebServiceModel.getServiceImpl();

yourServiceViDocument logicalPort = (yourServiceViDocument) service.getLogicalPort("Config1Port_Document" , yourServiceViDocument.class );

BaseGeneratedStub stubForLogicalPort = (BaseGeneratedStub) logicalPort ;

SecurityProtocol securityProtocol = (SecurityProtocol) stubForLogicalPort._getGlobalProtocols().getProtocol("SecurityProtocol");

securityProtocol.addHeader("Cookie","MYSAPSSO2="getSSOTicket()";");

private String getSSOTicket() {

IWDMessageManager msgMgr = wdThis.wdGetAPI().getComponent().getMessageManager();

try {

HttpServletRequest req = TaskBinder.getCurrentTask().getWebContextAdapter().getHttpServletRequest();

if (req != null)

return SSOSession.getSSOTicket(req);

else

return"";

} catch (Exception e) {

msgMgr.reportException(e.getLocalizedMessage(), true);

return "";

}

}

For this you need to add servlet.jar file in classpath.

Regards,

Bhavik