An Interactive Website and a SOAP-Based Web Service
This section has an example that uses GlassFish to host a website and Tomcat to host a SOAP-based web service that the website accesses. Chapter 3, on RESTful clients, has examples in which jQuery clients make calls against REST-style services that respond with JSON payloads; the JavaScript embedded in the web page puts the JSON to good use. The website in the current example is old school in that the HTML page contains no JavaScript. Instead, the page has a familiar submit button that, when pressed, causes an HTML form to be POSTed to a JSP script, which then calls upon a SOAP-based service to perform simple computations. The results of these computations are displayed on the web page. The interaction is among an HTML page, a JSP script with access to wsimport-generated artifacts, and a SOAP-based service (see Figure 7-5). This distributed application performs temperature conversions. To make the example realistic and to set up a comparison between deployment details, the web service is published with standalone Tomcat and the website is published with GlassFish.
Figure 7-5. An architectural sketch of the tcSiteAndService
The HTML page index.html (see Example 7-2) contains a simple form with a text box into which a user enters temperatures to be converted into fahrenheit and centigrade. To keep matters simple, the CSS styling is embedded ...
Get Java Web Services: Up and Running, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.