4 Replies Latest reply: Dec 18, 2007 6:03 AM by 569333 RSS

    Content Upload with WebCache

    470952
      Hi guys,

      I have two servers each hosting an oracle content services (OCS 10.1.2.3) application tier behind a webcache server in load balancer mode. These two application tiers use the same infrastructure and database.

      I succeed in using the OCS web services from a client application. But now I need to upload and download content to and from files. And this does not works.

      Here my understanding : when I want to create a session for the web services I use the service to service web service. To do this, as described in the Oracle samples, I use the HTTPCient. This object returns me a session cookie. This is the cookie that I use for all following calls to other web services. So far so good.
      Then I want to upload content to a file. So to do that I create a new HTTPConnection using the session cookie received before, when I have created the web services session. Here is the problem. Because when I address this upload call to webcache, it does not know to which application tier transmit it. So, some time webcache reroute the call to the application tier that already host the session, and it works well. And other time wecache reroute the call to the application tier that does not host the session causing a exception.

      So my question is: how is it possible to upload and download content to a file using webdav and web services, when there are two application tier behind a webcache in load balancer mode.

      Many thank for any help.
        • 1. Re: Content Upload with WebCache
          432524
          You could try to configure the two webcaches in a cluster so that they know of each other.
          Not sure if this will help with the session cookie problem.

          cu
          Andreas
          • 2. Re: Content Upload with WebCache
            102972
            You should grab all the cookies (not just the session one) from the first session and use it for subsequent requests. Load balancers, web cache etc also return cookies that they expect to see on subsequent requests.

            regards,
            -sancho
            • 3. Re: Content Upload with WebCache
              538402
              Hi,

              How to grab all the cookies from all sessions.. Is there any way to programatically achieve this..

              Thanks,
              Eshwar
              • 4. Re: Content Upload with WebCache
                569333
                It should look something like this (the most tricky part is the usage of the Cookie constructor, of which the original sample source coming from Oracle web site is WRONG):

                Object ctx = new Object();
                Calendar c = Calendar.getInstance();
                c.add(Calendar.DATE, 1);
                Date d = c.getTime();
                Sys.log.printInfo("Expiry Date = " + d);

                for (int i = 0; i<sessionCookies.length; i++) {
                String sessionCookie = sessionCookies;
                Sys.log.printInfo("Cookies:" + sessionCookie);
                String[] cookieExp = sessionCookie.split("=");
                Sys.log.printInfo("Cookie name:" + cookieExp[0]);
                Sys.log.printInfo("Cookie value:" + cookieExp[1]);

                Cookie cookie = new Cookie(cookieExp[0], cookieExp[1], url.getHost(),
                "/content", d, false);
                CookieModule.addCookie(cookie, ctx);
                }

                               // create an HttpConnection to the Document and set its context
                               httpCon = new HTTPConnection(url);

                               httpCon.setContext(ctx);
                               // turn off interactive mode
                               httpCon.setAllowUserInteraction(false);