6 Replies Latest reply on Oct 9, 2006 12:20 PM by Manik Surtani

    Caching for Web services?

    zzzz8 Newbie

      I couldn't get this answered in the Beginner's Corner forum, so hopefully it can be answered here. Does JBoss have anything in the middleware stack that helps address this issue? Is JBossCache only for DB interactions?

        • 1. Re: Caching for Web services?
          Brian Stansberry Master

          You can use JBoss Cache to cache pretty much anything you want. It's frequently used in situations that don't involve DB interaction; e.g. JBoss AS uses it to cache web sessions, EJB3 SFSBs, and (in JBoss 5) objects placed in the replicated HA-JNDI tree.

          • 2. Re: Caching for Web services?
            zzzz8 Newbie

            Thanks for the info Brian. I've only quickly glanced at the tutorial - and perhaps I should do some extra reading before I ask this - but do you have any examples that relate to caching Web services. I couldn't find this in the tutorial. In particular, I'm looking for examples (or just some simple advice as to how to start doing this) as to how to implement this against JAX-WS 2.0. Thanks!

            • 3. Re: Caching for Web services?
              Brian Stansberry Master

              I'm not aware of any tutorial or example specific to web services.

              • 4. Re: Caching for Web services?
                Manik Surtani Master

                What specifically do you need to cache WRT. web services? And is the goal to cluster/share state?

                • 5. Re: Caching for Web services?
                  zzzz8 Newbie

                  Hi Manik,

                  Thanks for the reply.

                  I have an application (JEE app - running on Tomcat/EJB3 embedded/Seam) that acts as a Web services client. I use JAX-RPC's wscompile (will upgrade to JAX-WS/wsimport in the near future) to generate the client side source code. The app does tend to invoke the Web services operations fairly frequently, so it would be nice to have some sort of client side cache. I currently don't need to cluster/share state, so a local-type cache is OK for me (for now - although I may want to have some sort of replicated cache in the future).

                  I have recently read some of the JBoss Cache documentation and I believe I may have some ideas as to how to implement this (please tell me if I'm way off or on target).

                  Because wscompile/wsimport generate source code files that are used by the Web services client, I could possibly aspectize certain source code files generated by wscompile/wsimport. It might be a little annoying to write the jboss-aop.xml file... I have figure out which files to aspectize and how to use the pointcut language to only aspectize those source code files involved in the response messages (and any related classes used in these response classes). I would only aspectize the response message classes since there should be no need to aspectize the request message classes. I'm also assuming these source code files could be aspectized (I'm not sure if there are any limitations in aspectizing the wsimport/wscompile generated source code files)...

                  I think once I aspectize these files (hopefully correctly), it would seem to be fairly straightforward to use the PojoCache... I probably need to learn a little bit more about PojoCache though. The toughest thing seems to be the configuration file, which really confused me. I couldn't find any definitive documentation on the XML config file (perhaps I missed it).

                  It would be nice if there was a less intrusive way of caching Web services - perhaps via JAX-WS handlers (that might be uglier) or if JBoss Cache were better integrated with JAX-WS/JAX-RPC.

                  Again, thanks for the assistance.

                  • 6. Re: Caching for Web services?
                    Manik Surtani Master

                    There is an entire chapter on configuration:

                    http://labs.jboss.org/file-access/default/members/jbosscache/freezone/docs/1.4.0/TreeCache/en/html/index.html

                    Do let us know if you have any success with your efforts. :-)