[CS277] XML Processing and Web Services. Notre Dame de Namur
University (2004). Foundation class for now-defunct MA in
Computer Science program launched by NDNU in the Fall of 2004.
Code samples below include both client and server-side Java (Servlets and JSPs),
WSDL, SOAP, and so on (not running due to lack of Tomcat or other java server by hosting provider).
Addressbook Manager (Final Project): Complete application to manage XML-based address book
(AddressBook.xml) file. Developed user interface to add, delete, search, and edit contacts in the AddressBook.xml file.
Implemented as JavaServer Pages (JSPs), deployed to Apache Tomcat. More...
Other Java web service code samples:
- Web service that calculates compound interest payment amounts and total cost over the life of a loan, and a simple Java
console based client that calls the Web service. This Web service has been deployed on a Tomcat 5
install running Axis. Here's the web-services deployment descriptor file for the project,
the WSDL that was generated by Axis/Tomcat after deploying to the
server. Screenshot shows the client program executing and obtaining response
from the Web service.
- Write a Java program that uses the SAX parser to parse the AddressBook.xml, search for an printout one of the contacts from the AddressBook.xml. This was a real pain, no question, and seemed like more trouble than it was worth. I've a feeling JAXB might have been a better choice, but I'm still trying to get a handle on JAXB.
- Write a simple Newspaper.xml file based on this XML Schema (newspaper.xsd), and a Java program (Newspaper.java) that gets a headline that matches the name of the author entered at the command line.
- Write a Java program [ContactPrintout.java] that finds a contact in the AddressBook [note that when you click on the link to display the addressbook.xml, you're getting the results as filtered by the XML Stylesheet] and displays all the data about that contact. Uses the DOM interfaces. This program has two versions:
- the ContactPrintout.java version is very simple. It finds the contact's last name, then first name, then backs up the tree to find the Contact node for that contact, then sends to a recursive method the other complexElements of the XML (PrimaryInfo, HomeAddress, HomePhones, and so on (see the AddressBook.xsd for details)).
- ContactReport.java is an alternative approach, which spends a lot of time extracting just the information of interest, without the element names, and prints out in a more 'narrative' style the particulars of the found contact. I think the way I'm working with the data in this latter program would have been better suited to JAXBI'll try that later, after I've finished creating the SAX version of this program.
- Create an XML Schema, XML document, and XSLT stylesheet for an AddressBook. Using XPath expressions to find only certain nodes.
- Create DTDs to be used for XML addressbook. Two primary approaches: