You are to develop a pair of Web Services, complete with matching WSDLs and client software, which
implement the functions of a Local Time Converter (LTC) service. A Local Time Converter service
allows users to provide the Local Time (e.g. 13:30) at one location (e.g. SYDNEY) and be provided the time at another (e.g. AMSTERDAM – in which case the time would be 05:30). It is usual for such
services to keep information relating the difference (e.g. SYDNEY is +10, AMSTERDAM is +2) at
each time location relative to the time at Greenwich (which is called Greenwich Mean Time or GMT
(or UTC)).
The first Web Service (called MyLTCServer) presents an API for the service’s users. This API
allows the following unauthenticated functions:
??Retrieve the time offset (relative to GMT) for a specific location
(double currentOffset(String location))
Returns a double representing the time offset relative to GMT for the provided location.
??Retrieve a list of currently supported locations (String listLocations())
Returns a String containing each of the currently supported locations, separated by “n”.
??Convert a time in one location to the time in another
(String convert(String from, String to, String time))
Returns a String representing what time it is in the location to when it is time in the
location from. The String representing time, and the return String, will be in the format
HH:MM (with leading zero on the HH if necessary).
The second Web Service (called MyLTCAdmin) presents an API for the service administrator. This API allows the following authenticated functions:
??Add a new location to the system with its current time offset relative to GMT
(boolean addLocation(String user, String pwd,
String location, double offset))
Returns false if the location already existed or the user credentials are invalid, true if the
new location has been added.
??Update the time offset for a specific location (for example when Daylight Saving Time
commences or ceases for the location)
(boolean setOffset(String user, String pwd,
String location, double offset))
Returns false if the location does not exist or the user credentials are invalid, true if the
location exists and has been updated.
??Retrieve the number of client web service calls performed on either interface since the server
started
(int callCount(String user, String pwd))
Returns -1 if the user credentials are invalid, otherwise returns the total number of calls
(including this one) on either of the server interfaces.
Note that, as reflected above, the administrator web service requires a username (user) and password (pwd) to be passed with each web service call. The server should validate this username and password before performing any requests. You should hard-code an administrator username of ‘admin’ and a matching password of ‘converter’.
To match these two web services, you will generate matching WSDL files and implement two sample
command-line based clients – one for the standard user (MyUserClient) and one for the
administrator (MyUserAdmin).
The command-line clients will allow each of the above-listed functions to be performed, passing in the
required parameters from the command line. For example, you may implement the “Retrieve the
current time offset for a specific location” function call by executing the command:
java MyUserClient currentOffset SYDNEY
The server’s starting set of time offsets may be hard-coded as follows:
Offset relative to Greenwich = +10 (SYDNEY)
= +2 (AMSTERDAM)
= -7 (LOS ANGELES)
= +8 (BEIJING)
The server stores the list of supported locations, their corresponding time offsets relative to GMT, and
the number of user web service calls performed in memory. It does not need to render them persistent
by storing them to disk.