Create a Web service that permits users to send short text messages to other users and receive messages from other users. The Web service is termed asynchronous because messages are not received as soon as they are sent; users decide when they want to receive messages.

When a user logs in with a name and password, the Web service authenticates him by searching a database table. If the user is accepted, a unique ID number is created and sent to the user. The Web service uses this ID number to identify the user in all subse- quent calls to Web methods.

A user sends a message by calling a Web service method and passing a user ID, the name of the recipient, and the message text. A user receives her messages by passing a user ID to a Web method that returns an array of message strings.

When the user logs out, the unique ID assigned to the user is discarded. Here are the suggested method declarations:

'Logs into the message service with a username and password.
'Returns a unique integer to be used in subsequent transmissions.
Public Function Login(ByVal user As String,
ByVal passwd As String) As Integer
'Sends a message to a specific user. Parameters:
'userId: unique identifier returned by Login method.
'recipient: username of the receiver of the message
'msg: the text of the message
'Returns True if the userId is recognized, or False if it is not.
Public Function Send(ByVal userId As Integer,
ByVal recipient As String,
ByVal msg As String) As Boolean
'Gets all messages addressed to the current user.
'If the userId is recognized, an Array of String containing
'the messages is returned; otherwise, an empty array is returned.
Public Function GetMessages(ByVal userId As Integer) As String
'Logs out of the mail service. Discards the unique user ID.
Public Sub Logout(ByVal userId As Integer)
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.