XSLT Web Services Framework

XML/XSLT Web Services Framework (XWSF) provides a simple and lightweight yet powerful environment in which one can script Web Services clients and servers using XSLT and Java.

Background and Rationale

The underlying philosophy is that XSLT is the perfect scripting language to glue together complex XML information and Java code. XSLT is a powerful functional programming language all by itself and perfectly fits into a world of pervasive XML. XSLT is the most convenient way to analyze and manipulate complex XML data structures and to perform actions based on this data. With a relatively standard way to call out to Java extension functions from most Java-based XSLT engines, scripting with JDBC or other Java resources is easy, and yet, with XSLT being a functional language, it is hard to write bad code in XSLT (which is a problem with most "scripting" languages). Certainly XSLT is the only fully-standard XML conformant alternative for dynamic web pages and and web-services and as such could fully replace JSP and other not-quite XML based approaches.

Contents

Initially this project includes a simple XSLT Servlet, called the "Generic SOAP Transform Server" (GST). Initially this works within the Java Web Services Development Pack both as a webapp sub-directory and as a war-file. A very simple SOAP adapter XSLT transform exists that can adapt other XSLT transforms to deal with some of the SOAP overhead.

My emphasis is on web-services, but only because I do not do web-user-interfaces at this time. Otherwise I most certainly will use this same framework for user interfaces instead of JSP, velocity or other ad-hoc, or not quite-XML based active server pages. In fact, I already do one dynamic HTML web site in the gstserver/index.xsl that creates an index of available services by transforming the WEB-INF/web.xsl file. There are no limits and this SOAP thing is really totally optional.

To support XSLT-based clients to interact with Web Services two critical XSLT extensions are being provided at this time.

  1. A post:message style element that sends an XML node-set through HTTP/POST to a server and returns the server's response as an XML node-set.

  2. Extension elements ex:try, ex:catch and ex:throw, and the extension function ex:current-exception() to handle Java exceptions in XSLT. This is quite useful well beyond Web Services, for example, when calling out to JDBC or any other extension that might throw an exception you need to catch to generate valid and useful XML results.

These extensions are currently written for Saxon in its versions 6 and 7. I maintain only Saxon 7 XSLT 2.0 code from now on.

Future Directions

This project will remain simple and focused on XSLT with Java only. I will guard it from becoming entrenched in all sorts of nifty baggage, and will try to avoid configuration and maintenance to require an advanced degree (unfortunately simplicity isn't something we see very often with XML and Web stuff [:-)] .

This already is, and will continue to be a powerful tool to build all kinds of services, but it will not be a swiss army knife to provide all sorts of blades to cut the same cake. While we need certain extension elements and functions in XSLT to do the most basic things, I do not plan to provide syntactic sugar to something that can be as readily done by direct Java calls.

I will do some more work on the GST servlet to funnel other types of input data into the world XML/XSLT processing. One such input is be HL7 (an EDI standard in health care), and more generally useful HTML form data as it comes from both HTTP/POST and HTTP/GET submissions. Also, the GST servlet should support security related objects, (user sessions and authentication contexts) and other helpers, such as JDBC connection pools, etc. But again, I will to do a sensible pick of one option for each purpose and make configuration of those most generic and straight-forward.

Welcome

For CVS, news, discussions, and releases, please visit the project page on SourceForge.

One motivation for me to put this project into a public forum such as SourceForge is that I hope others will help port the extensions to Xalan and other major Java-based XSLT engines.


SourceForge Logo