CS 580 Client-Server Programming

Spring Semester, 2007

Assignment 5

Assignment Index

© 2007, All Rights Reserved, SDSU & Roger Whitney

 San Diego State University -- This page last updated 4/26/07

Assignment 5

Due May 8

XML-RPC Voting

Modify your server from assignment 4 to use XML-RPC as the communication layer. The server needs to support the same functionality as your server from assignment 5. The protocol from assignment 4 does not apply. Instead your server should expose to clients the methods:

int login(String user, String password)

    login returns the error codes for the LOGIN command from assignment 4. That is 0 indicates success, 100 invalid login attempt, etc.

struct pollStatus()

    The struct contains two keys: return-code and polls. The value at return-code is an integer as indicated by POLL-STATUS command in the assignment protocol (0 or 125). The value at the key polls is a collection containing 0 or more poll structs. A poll struct contains three keys: poll-id, label, status. The value at poll-id is an integer representing the poll-id. The values for the keys label and status are strings, as indicated in the assignment 4 protocol.

int register( String user, String password, String nickname )

    The arguments should be self-explanatory. The method returns a return code as indicated for the REGISTER command.

int vote(int pollId, String option)

    The arguments should be self-explanatory. The method returns a return code as indicated for the VOTE command.

struct voteStatus(int pollId)

    The return struct has two keys: return-code and option. The value at return-code is an integer as indicated by VOTE-STATUS command in the assignment protocol (0 , 125, 126). The value at option is a stri ng, which is the option the user has voted for in that poll.

The vote data should be stored in a database. Information like, but not limited to, database username, database password, data location, server port and log file should be set in a configuration file and changeable via the command line when starting the server. Connections to the server and any exceptions need to be logged. The server needs handle more than one connection at a time. Provide unit tests for your server.

Given the nature of xml it is not feasible to use telnet to test your server. You will need to create a simple XML-RPC client for your server.

Java programmers can download XML_RPC framework for Java at: http://ws.apache.org/xmlrpc/xmlrpc2/index.html . The same site contains instructions and examples.

An XML-RPC framework is included in the standard Ruby library.