Skip to Content
author's profile photo
Former Member

Cookies in WebDynpro

Hi,

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Oct 05, 2005 at 03:52 AM

    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

    Add comment
    10|10000 characters needed characters exceeded