Web service
In this part of the project you will implement a simple web service
based on the transformations and queries made in the first four
parts. A web service is simply a program that can be contacted via
some internet protocol and offers to do some kind of processing or
computation.
Input and output
In our scenario the web service is simply a program that takes as
input:
- Some bibliographic data (in XML-bib or BibTeX format)
- A description of one of the queries/transformations you have
implemented, i.e., either:
- The number of a query and any parameters, or
- The desired format (XML-bib or XHTML) that the (entire)
bibliographic data file should be returned in.
The web service returns the result of the query on the data as an XML
file. Whenever the web service transforms BibTeX to XML-bib you should
use your schema to verify the soundness of your transformation. You
may choose to define schemas for the various types of XML output, but
this is not mandatory.
A simple web service in Java
We recommend you to base your web service on sockets in Java (see
documentation for java.net
library). You may do this by modifying a simple java
program that implements a file server. You should only have to
modify a small part of the program.
Note: One group has had the problem that Java's readline() method did not return
null when there was no more data from the socket. A solution is to look for an explicit
sign that the end of the transmission has been reached, e.g., a string of the form
---------...------6f123a123.
You can use the Multiclient
java program to test your web service. To run the multiclient type:
java MultiClient <host> <port>
where <host> is an identifier for the web server host
and <port> is the number of the port used for the
socket. The IT-C firewall seems to block most ports on student
machines. However, one can test the web service and client together on
a single machine by using the identifier 127.0.0.1 and any
available port number (e.g., choose a random number in the range
10000 to 20000).
Encoding of data
The file server uses the HTTP protocol. You may choose any encoding
you like of the data sent to and from the web service. One choice that
makes the last part of the core project easier is to base the encoding
on HTTP, and use the same encoding of query parameters as that
generated by the HTML form used for the web interface. In that way you
can use the web service directly from the browser.