Skip to main content

JSP Tag Library for Web Services

Posted by simongbrown on January 13, 2005 at 12:53 PM PST

A new JSR has been created that proposes to build a JSP Tag Library for Web Services...

A JSP tag library for Web Services is a happy union of the two technologies that will help JSP page authors integrate Web Services into their web applications with minimal effort and quick turnaround times. In addition to existing standards for both Web Services and JSP technologies, there is industry wide acceptance and widespread usage of both the technologies. All of these facts make a compelling case for creating a standard for this tag library.

While I think that standard tag libraries are great, I'm not convinced about the need to access web services directly from JSP pages. The existing JSP Standard Tag Library includes support for accessing data sources via JDBC and it's a widely accepted view that you'd only do this for small/simple web applications. Accessing the database from your JSPs will eventually lead to complex applications that are hard to understand and maintain. In addition to this, your JSPs are not isolated from changes to the database schema and you have few places to go if you come up against performance problems later on. Moving data access further back in the architecture provides more scope for aspects such as reuse, maintainability, caching and so on. I think that these points are equally valid to a standard taglib that accesses web services.

Of course, like the JSTL database tags, people will use them. Not everybody has the luxury of being able to design, influence or modify the architecture of an application and lots of people just want to build a system that works. There's nothing wrong with this and standardizing on a way to access web services from JSP can only be a good thing in these situations. So, rather than just bile the idea, I'd like to offer some suggestions, perhaps for a future version of the JSR.

  • Caching : For performance reasons it would be nice if you could specify that the results from a particular web service are cacheable and specify the timeout of those cached results. The temperature service in the JSR is a good example. Specifying, through an attribute or an enclosing tag, that the results of this web service can be cached for a few minutes could substantially reduce the number of calls to the web service, increasing performance and scalability. Of course, developers could wrap the web service taglib with something like OSCache, but this adds complexity into simple solutions.
  • Other protocols : I know that the taglib is aimed at accessing standard web services (i.e. SOAP, WSDL, etc), but there could be some scope here to build something that provides a generic mechanism for accessing other types of "web services" - there are a lot of people using lightweight XML-RPC and REST approaches for remote APIs and system integration.

If a standard web services taglib is available, people will use it. I guess that this is our chance to have an input into its future.

Related Topics >>