8 Replies Latest reply on Feb 10, 2009 8:45 AM by claprun

    WSRP Producer:  Need to set requiresInitCookie

    jgrangethales

      Hi,

      I'm having some session problems when consuming jboss wsrp portlets in microsoft sharepoint. Before posting the full problem here, I wanted to set the requiresInitCookie on the WSRP producer to perUser just to see if it helps - Unfortunately, I can't find out how to set it. Can anybody help?

      I'm using Portal 2.6.6 on AS 4.2.3 (windows 2k3 server)

      TIA

        • 1. Re: WSRP Producer:  Need to set requiresInitCookie
          claprun

          There is currently no easy way to change the value of requiresInitCookie on the WSRP producer. I will file a JIRA to expose this configuration setting via the producer configuration interface.
          That said, the producer should already require initCookie to be performed on a per user basis. If not, this is a problem.

          • 2. Re: WSRP Producer:  Need to set requiresInitCookie
            claprun

            To be a little more precise, our WSRP producer does not currently require use of cookies so we did not include the capability for users to configure this option.
            Cookies initialized via initCookie are unrelated to session management and changing the initCookie policy should not have an impact on this.
            We do currently require a call to initCookie to be made once per user but this is a workaround for an interoperability issue we found with some versions of BEA Portal.

            • 3. Re: WSRP Producer:  Need to set requiresInitCookie
              jgrangethales

              I've investigated the problem futher and it appears that the SharePoint WSRP web part is sending the JSESSIONID cookie on getMarkup requests but not on performBlockingInteraction requests.

              The consequence of this is that a new session is created for processAction in my test portlet (source code below), but not for each doView.

              BTW: The actionURL.toString()+"/wsrp_rewrite" bit was needed to get sharepoint to rewrite the action url. the /wsrp_rewrite at the end of the action url was there under portal 2.4.2, but appears to have disappeared for 2.6.6 - would you like that as a separate post?


              package org.jboss.portlet.hello;

              import javax.portlet.GenericPortlet;
              import javax.portlet.PortletException;
              import javax.portlet.RenderRequest;
              import javax.portlet.RenderResponse;
              import javax.portlet.UnavailableException;
              import java.io.IOException;
              import java.io.PrintWriter;

              import javax.portlet.ActionRequest;
              import javax.portlet.ActionResponse;
              import javax.portlet.PortletMode;
              import javax.portlet.PortletPreferences;
              import javax.portlet.PortletURL;
              import javax.portlet.WindowState;

              public class HelloWorldPortlet extends GenericPortlet
              {

              public void processAction(ActionRequest request, ActionResponse response) throws PortletException {

              // process the salutation set by the user in the edit mode.

              String username = request.getParameter("username");
              request.getPortletSession().setAttribute("username", username);
              Integer count = (Integer) request.getPortletSession().getAttribute("accesscount");
              System.out.println("username = " + username + ", count = " + count);



              }

              protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException, UnavailableException
              {
              // prompt the user for the salutation.

              Integer count = (Integer) request.getPortletSession().getAttribute("accesscount");
              if (count == null) {
              count = new Integer(0);
              }

              count++;

              request.getPortletSession().setAttribute("accesscount", count);
              String username = (String) request.getPortletSession().getAttribute("username");
              PortletURL actionURL = response.createActionURL();

              response.setContentType(request.getResponseContentType());

              PrintWriter writer = response.getWriter();

              // writer.write("<form method=\"post\" action=\"" + actionURL.toString());
              writer.write("<form method=\"post\" action=\"" + actionURL.toString()+"/wsrp_rewrite");

              writer.write("\">Name:<INPUT TYPE=\"TEXT\" NAME=\"username\"><INPUT TYPE=\"submit\" NAME=\"SUB1\" VALUE=\"Submit\">");
              writer.write("Hello " + username + ". Access count=" + count + "");


              writer.close();
              }
              protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException, UnavailableException
              {
              doView(request, response);
              }
              }

              • 4. Re: WSRP Producer:  Need to set requiresInitCookie
                jgrangethales

                Sorry, I should have said on the previous post : have you any suggestions for how to get around this?

                • 5. Re: WSRP Producer:  Need to set requiresInitCookie
                  uiterlix

                  Hi,

                  Currently we're having the exact same problem as described in this thread. Has anyone found a solution ?

                  Thanks,

                  Xander

                  • 6. Re: WSRP Producer:  Need to set requiresInitCookie
                    claprun

                    I have validated that the missing wsrp_rewrite is indeed an error:
                    https://jira.jboss.org/jira/browse/JBPORTAL-2306.

                    For the other issue, this is a SharePoint issue. Per the WSRP specification:

                    If a Producer indicates that it uses cookies, the Consumer MUST ensure that any cookies the Producer sets are available on all invocations within the Markup interface.


                    • 7. Re: WSRP Producer:  Need to set requiresInitCookie
                      jgrangethales

                      This is indeed a sharepoint issue -

                      I have a service request open with microsoft on this (SRZ080915000073).

                      Analysis of the http traffic indicates that the problem is due to the fact that cookies are being correctly sent by the web part for the getMarkup operations, no cookies are being sent during the performBlockingInteraction requests, despite the fact that Set-Cookie headers are returned by the WSRP provider.

                      • 8. Re: WSRP Producer:  Need to set requiresInitCookie
                        claprun

                        Thanks for the update. JBPORTAL-2306 should be fixed now for both 2.6 and 2.7.