Distributed Computing Assignment 1 Total Marks: 30
A SIMPLE SERVICE ORIENTED ARCHITECTURE
Your task is to build a simple SOA (service-oriented architecture) described in the following picture:
You have to create four separate projects where each project represents an actor of the SOA:
1. Authenticator: It provides authentication services. The other actors, i.e., client, Service provider, and registry communicate with the authenticator when they need to validate any information.
2. Service provider: It provides basic mathematical services, i.e., add, multiply, generating prime numbers, and checking for prime numbers.
3. Registry: It provides basic service registration services for the providers, and has searching services for the client.
4. Client: Its job is to invoke and test the services that are provided by the service provider.
The basics of the simple SOA are as follows: the service provider publishes its services to the registry. It means the name of the service, its description, and service endpoints are stored in the registry. The client can search for a service in the registry using the description of the service. The search result will return the actual service endpoint, and the client can use the endpoint to invoke the service. In any service invocation among the client, provider, and registry, the actors have to prove that they are authenticated by the authenticator.
Every project instance will run in a single machine. So, we don’t need service orientation in a single project. However, it is expected that you will design the projects using object-oriented principles. Every project may have the business layer and the data layer. The business layer is for handling the logic and data layer is for managing the data. You don’t need to implement services between layers in a single project.
1
You are free to use your own messaging (input or output) formats. You don’t have to follow exact formats in the examples given in this document.
We will have a demonstration session to demonstrate each functionality. Max 5 Marks could be deducted for design quality and code commenting. Build all the projects in a single solution. However, each project is expected to be independent (minimal code reference to other projects in the solution.) There is also an opportunity to score bonus 5 marks.
The Authenticator Project [4 Marks]
It is a .NET remoting server. “net.tcp://localhost/AuthenticationService” is an example of a fixed service endpoint. It has three operations open as service functions:
a) String Register (String name, String Password): It expects two operands, i.e., name and password from an actor. It saves these values in a local text file. If successful it returns “successfully registered”. [2 Marks]
b) int Login (String name, String Password): It expects two operands, i.e., name and password from an actor. It checks these values in a local text file. If a match is found, it creates a token (random integer), saves it into another local text file, and returns it to the actor who calls this function. [1 Mark]
c) String validate (int token): It expects a token and checks whether the token is already generated. If the token could be validated, the return is “validated”, else “not validated”. [1 Mark]
Bonus: There is an internal function that clears the saved tokens in every ‘x’ minutes. When you run the authentication server, it will ask for the number of minutes for the periodical clean-up in the console (using multithreading). [2 Marks]
The Service Provider Project [7 Marks]
It is an ASP.NET Web API project that creates Rest services:
a) ADDTwoNumbers: This rest service adds two input integers and returns the output in JSON [0.5 Mark]
b) ADDThreeNumbers: This rest service adds three input integers and returns the output in JSON [0.5 Mark]
c) MulTwoNumbers: This rest service multiplies two input integers and returns the output in JSON [0.5 Mark]
d) MulThreeNumbers: This rest service multiplies three input integers and returns the output in JSON [0.5 Mark]
2
e) GeneratePrimeNumberstoValue: This rest service generates prime numbers from 1 to an input value and returns the output in JSON. [0.5 Mark]
f) GeneratePrimeNumbersinRange: This rest service generates prime numbers in a range (two inputs) and returns the output in JSON. [2 Marks]
g) IsPrimeNumber: This rest service checks whether a number is prime and returns the output accordingly in JSON. [0.5 Mark]
There is no data layer in this project.
[2 Marks]
The provider has an additional business logic before providing the service. Every client should be authenticated before the service invocation. So, the service provider expects a valid token with every service call. The provider calls the validate function of the Authentication service and if validated the service is provided. Otherwise, the following JSON output is sent:
{
“Status”: “Denied”
“Reason”: “Authentication Error”
}
The Registry Project [7 Marks]
It is an ASP.NET Web API project that creates the following Rest services:
a) Publish: This rest service saves the service description in a local text file. If successful it returns the status accordingly in JSON. This service expects the input in a JSON format. For example, the ADDTwoNumbers service description could be input as follows: [2 Marks]
{
“Name”: “ADDTwoNumbers”
“Description”: “Adding two Numbers”
“API endpoint”: “http://localhost:port/ADDTwoNumbers” “number of operands”: 2
“operand type”: “integer”
}
b) Search: This rest service searches an input service description in a local text file and returns the service information. You are allowed to use any C# textual search library. For example, a search with the text ‘add’ may return the following JSON [2 Marks]
{
[
{
“Name”: “ADDTwoNumbers”
3
}
“Description”: “Adding two Numbers”
“API endpoint”: “http://localhost:port/ADDTwoNumbers” “number of operands”: 2
“operand type”: “integer”
},
{
“Name”: “ADDThreeNumbers”
“Description”: “Adding three Numbers”
“API endpoint”: “http://localhost:port/ADDThreeNumbers” “number of operands”: 3
“operand type”: “integer”
},
c) AllServices: This rest service returns all the services saved in the local text file in JSON format. [1 Mark]
d) Unpublish: Given a service endpoint, this rest service will remove the service description from the local text file. [1 Mark]
[1 mark]
The registry has an additional business logic before providing the service. Every client should be authenticated before the service invocation. So, the registry expects a valid token with every service call. The registry calls the validate function of the Authentication service and if validated the service is provided. Otherwise, the following JSON output is sent:
{
“Status”: “Denied”
“Reason”: “Authentication Error”
}
The Service Publishing Console Application [4 Marks]
This is a C# console application to publish services. It is up to you how to design the user interface. You need to demonstrate that you can do the following operations.
a) Registration: the app asks for the username and password in the console and sends them to an appropriate Authentication service. [1 Mark]
b) Log in: the app asks for the username and password in the console and sends them to an appropriate Authentication service to verify. If successful, the returned token is saved in its program memory. This token will be sent as an additional parameter for every subsequent service call. [1 Mark]
c) Publish service: the app asks for the service name, description, API endpoint, number of operands and operand types in the console and sends them to an appropriate Registry service to publish. [1 Mark]
4
d) Unpublish service: the app asks for API endpoint in the console and sends them to an appropriate Registry service to unpublish. [1 Mark]
It is expected that you display the result of each operation in a meaningful way. You are allowed to use the RestSharp library.
The Client GUI Application Project [8 Marks]
You are free to use any GUI framework, i.e., WPF or Web or anything. It is up to you how to design the user interface. You need to demonstrate that you can do the following operations:
a) Registration: the app asks for the username and password in the GUI and sends them to an appropriate Authentication service. [1 Mark]
b) Log in: the app asks for the username and password in the GUI and sends them to an appropriate Authentication service to verify. If successful, the returned token is saved in its program memory. This token will be sent as an additional parameter for every subsequent service call. [1 Mark]
c) Show all available services: The GUI will call the appropriate Registry service to retrieve all the available services. The list of available services will be displayed in a manner so that they will be selectable. [1 Mark]
d) Search a service: the app asks for the service description in the GUI and sends them to an appropriate Registry service. The list of search results will be displayed in a manner so that they will be selectable. [1 mark]
e) Testing a service: The user will select a service graphically. Let us assume the user selects the ADDTwoNumbers service. The GUI app knows the API endpoint and number of operands from its search results. Next, it will create the input boxes for the service testing automatically in the GUI. As ADDTwoNumbers needs two operands two input boxes will be shown for the input and a ‘test’ button. When the button is pressed the GUI will call the service using the API endpoint and display the result. [4 Marks]
It is expected that you display the result of each operation in a meaningful way.
Bonus: If you use multithreading when calling the functions and display a progress bar in the GUI [3 Mark]
Submission
Submit your assignment electronically, via Blackboard, before the deadline. To submit, do the following:
a) Fill out and sign a declaration of originality. A photo, scan or electronically-filled out form is fine. Whatever you do, ensure the form is complete and readable! Place it (as a .pdf, .jpg or .png) inside your project directory.
b) Zip up your entire solution or project directory as-is (as a .zip or .tar.gz file). Leave nothing out.
c) Submit your zip/tar.gz file to the assignment area on Blackboard.
5
d) Re-download, open, and run your submitted work to ensure it has been submitted correctly.
You are responsible for ensuring that your submission is correct and not corrupted. You may make multiple submissions, but only your newest submission will be marked. The late submission policy (see the Unit Outline) will be strictly enforced.
Please note:
• DO NOT use WinRar.
• DO NOT have nested zip/tar.gz files. One is enough!
• DO NOT try to email your submission as an attachment. Curtin’s email filters are
configured to silently discard emails with potentially executable attachments.
In an emergency, if you cannot upload your work to Blackboard, please instead upload it to Google Drive, or a private Github repository, or another online service that preserves immutable timestamps and is not publicly accessible.
Marking – Demonstration
You will be required to demonstrate and discuss your application with a marker in-person. You may use your own laptop OR the lab machines to do this. Most of the marks for your assignment will be derived from this demonstration. You must either be available during the practical sessions (will be announced later), or schedule an alternate time (in agreement with the marker/lecturer) before the start of the exam weeks.
Be prepared for the demonstrator to ask that you copy/run your assignment off a particular USB stick, or ask that you re-download it from the submission area on Blackboard, or similar. The demonstrator needs to be certain that the version demonstrated is the version submitted, so you cannot simply set everything up beforehand in preparation.
The demonstrator will ask you to rebuild and run your application, and to demonstrate the major features of it. They may ask you about any aspect of your submission.
Marking – Inspection
A smaller proportion of your assignment marks will come from a marker inspecting your code. This does not require your attendance, and is separate to the demonstration. The marker will be looking to ensure that your code is reasonably well commented, well structured, well formatted, and isn’t obviously defective. They may also confirm whether aspects of the functionality are present and correct, whether or not they have already been demonstrated.
Academic Integrity
This is an assessable task. If you use someone else’s work, or obtain someone else’s assistance, to help complete part of the assignment that is intended for you to complete your- self, you will have compromised the assessment. You will not receive marks for any parts of your submission that are not your own original work.
Further, if you do not reference any external sources that you use, you are committing plagiarism and/or collusion, and penalties for Academic Misconduct may apply.
6
Please see Curtin’s Academic Integrity website for information on academic misconduct (which includes plagiarism and collusion).
The unit coordinator may require you to provide an oral justification of, or to answer questions about, any piece of written work submitted in this unit. Your response(s) may be referred to as evidence in an Academic Misconduct inquiry.
7