Kasutajaliidesed lectures lab 2 requirements
The main goal of the lab is to practice using xml web services as a data source for web applications: either via xslt or direct parsing of xml.
You will have to create a functioning web app, based on the mock-up pages created during the first lab. It is not obligatory to follow the mock-up pages exactly: modifications, additions etc are fine.
Your application does not call any database engine directly: instead, it has to use the simple web services described below to fetch and add data.
It is OK to work in pairs or alone. Groups of three or more people are not OK.
Sisukord
Concrete requirements for the lab
- Data must be fetched, inserted, modified using the web services described below.
- You will have to build html from xml either using some xslt engine (recommendable) or by directly parsing xml.
- It is OK to use any programming language and any computer for the app. You may even - for example - build a java app with its own server, see Javaserver.zip.
- The application must be usable on the computers in the lab room using both Firefox and IE.
- The application - like the first lab - must be intuitively usable and must look decent: same gneral principles as for lab 1 still apply.
- You must use a student code of one of the group members as an obligatory parameter for web services. See the next chapter for details.
- It is recommendable to build
- page splitting
- column sorting
- searching
into the app. Apps without these capabilities will get lower points than apps with these capabilities.
- Please treat the web services and the dijkstra machine sparingly: do not make huge, repeated calls just for fun. Also, please try to avoid disturbing other students. For example, avoid using the student codes of other people.
Web service to use
You will have to use publicly available web services using the XSTONE server (you can find detailed information about XSTONE from http://www.ttu.ee/it/xstone. However, you will not really need this detailed information in the lab).
The XSTONE server runs in the dijkstra.cs.ttu.ee machine, port 7777. You may want to try out a service giving all parties currently in the database: http://dijkstra.cs.ttu.ee:7777/xstone/xfuns/party_all
Observe that you cannot change the underlying sql schema or xstone web services themselves: you can only use them as they are.
XSTONE server is called using ordinary url-s, via get. Post is not available. Web service url-s take string parameters without any parameter names: order matters. There is no authentication and you can test the services using an ordinary browswer.
Database schema and concrete services
The server contains a database with two tables:
- main table party: contains all main data about a party.
- additional table notes: contains additional notes for parties.
Observe that actually the schema contains also additional tables for similar application from 2005: tables house, description, visit and the corresponding web services. In case you are interested, see http://cs.ttu.ee/kursused/itv0030/prax2.html. You may use these web services for additional stuff, if you want. However, using them is in no way obligatory.
The XSTONE server contains simple SQL functions for looking and modifying data in the given tables. Every web service corresponds to one SQL sentence.
You should read the following files specifying the schema and services for the lab:
NB! We do not use authentication in this lab. Instead, each table row contains a student code for the student creating the application (in case you work as a group, please select the code for one of you). Your application must insert this code automatically (ie hard-coded into your app), it is NOT asked from the end user. The whole idea is to allow all students to use the same tables without messing up other students data.
Details about arguments to web services
- all: party_all and note_all do not take arguments and will give the whole table contents. This could be big. Please avoid using in normal situations, just to test stuff, if necessary.
- select: party_select, note_select take these args:
- column to sort in the table
- sorting order (asc or desc)
- student code of the student writing the app
- SQL-sentence WHERE-conditions (ie filter/search: in case you want to get all rows, enter 1=1).
- nr of rows to get.
- from which row to start getting the data (first row is 1)
- insert:
- party_insert: the first arg is student code, the following are data fields
- note_insert: the first arg is the id of the corresponding party, second is student code, rest are data fields
- update: first arg for party_update and note_update is the id of the row to be updated. The following arguments are either exactly as (note) or similar to (party) for insert.
- delete: no delete provided for party or note. Use party.status in your app instead.
- Date format is MM-DD-YYYY.
- You can check the success of insert/update by the resulting xml
Great example code
Check this half-baked code from a lecture for a standalone Java server in j2se doing all you need (sort of): Kasutajaliidesed lab 2 java server example
Check this small parties.xsl example:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict"> <xsl:output method="html"/> <xsl:template match="/"> <html> <table> <xsl:for-each select="/data/rec"> <tr> <td><xsl:value-of select="ID"/></td> <td><xsl:value-of select="STUDENT"/></td> </tr> </xsl:for-each> </table> this is output </html> </xsl:template> </xsl:stylesheet>
Open the url when the java server from above works: http://localhost:8080/allparties
Example url for submitting values (replace 1,2 etc with string values from your form, replace dates with date values from your form): http://dijkstra.cs.ttu.ee:7777/xstone/xfuns/party_insert?1&2&3&4&01.01.2000&02.02.2001&7&8&9&10&11&12