We could write the web service as JSP pages or as a servlet.
But we'll be manipulating XML (and HTML).
Maybe XSLT would be helpful.
It will be a multi-step process to translate the HTML page into a response.
An XML Pipeline would be very helpful here.