DPS907 WSA500 Assignment 5 – Fall 2017

Add link relations and documentation to a web service.

Read/skim all of this document before you begin work.


Due date

Monday, October 9, 2017, at 11:00pm ET

Grade value: 5% of your final course grade

If you wish to submit the assignment before the due date and time, you can do that.



Enable a hypermedia-driven web service to deliver responses that get closer to implementing REST architectural principles.


Introduction to the problem to be solved

Returning to the Chinook sample database, we need a web service that delivers hypermedia-aware responses.

For this assignment, we will work with a few entities, and will deliver selected properties from associated entities (but will not be delivering full/complete objects or collections).


Specifications overview and work plan

The following specifications apply to all of your assignments:

  • Follows best practices
  • Implements the recommended system design guidance
  • Customized appearance on the landing web page
  • Uses Entity Framework and Code First technology
  • Includes a Fiddler log file that shows complete coverage of tests

For this assignment, here is what we’re looking for:

  • Deliver “Employee” data, with link relations etc.
  • Modify “Employee” data, including add-new, and edit-existing
  • Add a “Customer” command to set/configure the employee support representative
  • Deliver “Invoice” data, with link relations etc.
  • Fully-implemented documentation components (code comments, XML code comments for the help page, entry/root URI)


During the class/session, your professor will help you get started and make progress on this assignment.

Every week, in the computer-lab class/session, your teacher will record a grade when you complete a specific small portion of the assignment. We call this “in-class grading“.

The in-class grading will be announced in-class by your professor.

DPS907 students must implement one additional use case, using the command pattern


Getting started

Create a new web service, named Assignment5. It must use the “Web service project v1” project template.

Remember to customize the home controller’s index view with your personal information, and the _Layout.cshtml view template with the application name.

Build/compile, and run (without debugging), to ensure that the app’s home > index view loads in a browser.


Doing the work

Before writing code for the use cases, add the infrastructure components that you learned about this week, including:

  • Error handler
  • HTTP OPTIONS handler
  • Classes for links and link relations
  • Enable and configure the Web API help page
  • Root controller

Make sure that you activate or configure each one, as you learned in the class notes.

After configuring the app’s infrastructure, you can circle back and do the programming work.

As a reminder, your professor believes that the best way to work through any assignment is to do it incrementally. Get one thing working correctly, before moving on to the next. Test each part.

Therefore, you will probably be cycling through the following programming tasks, for each use case. (You first saw this list in the Assignment 2 specifications.)

  1. Write the resource model class(es) that support the use case
  2. Add one or more AutoMapper mappings for the class(es) that you just added
  3. Write the Manager class method that performs the data service operation
  4. Create a controller, if necessary
  5. Write the controller method that implements the use case
  6. Test, using Fiddler, debug and fix if necessary

Incrementally doing these tasks will ensure that you’re making progress. You will also notice that they’re repetitive. That’s good, because the process will become familiar and natural to you.

Here are the use cases, as suggested from the text above:

  • Get all use case, Employee entity
  • Get one use case, Employee entity
  • Add new use case, Employee entity
  • Edit existing use case, Employee entity (address fields only)
  • Get all use case, Invoice entity
  • DPS907 students… Change state, a command, to set/configure a customer’s support representative (i.e. an employee)

All use cases will deliver responses that include hypermedia (link relations etc.). Therefore, you must write additional link-aware resource model classes for the Employee and Invoice entities. And, where necessary, AutoMapper “create map” statements.

Remember to add appropriate code comments to your controllers and manager.

Also, remember to add XML code comments on controller methods, to enable the Web API Help Page feature.

Make sure that you study the code examples, from this course and from the web apps course, to learn and implement the best practice way of designing and coding each programming task listed above. Also, use the comments and feedback that appears on your previous assignment checklists.


Info about the get all use case for Employee

This should deliver Employee data, and the name of the employee’s supervisor, as simple composed properties, that use the AutoMapper flattening feature.

The response must include link relations. You must add link-aware resource model classes.


Info about the get one use case for Employee

Similar to above, this should deliver Employee data, the name of the supervisor, and a collection of direct reports. With link relations (top-level object only, and not for the embedded direct reports collection).


Info about the add new use case for Employee

Similar to above, this should deliver Employee data, and supervisor name data. With link relations.


Info about the edit existing use case for Employee

Write a resource model class that will enable the editing of the address-related fields in the Employee entity (address, city, etc.).

Similar to above, the result of the edit task should deliver Employee data, and supervisor name data. With link relations.


Info about the get all use case for Invoice

This should deliver Invoice data, and the name of the associated customer, as simple composed properties, that use the AutoMapper flattening feature. With link relations.


(DPS907 students…) Info about the change state use case (set support rep) for Customer

As a command, this will not return data in the entity body of the response. However, you should call out the existence of the use case in the root controller response.


Testing your work

Use Fiddler.

Ensure that it has been configured to save the message bodies in requests and responses. (A default installation does not do this.) If you are using a College computer, this should have been configured, but check anyway. If you installed Fiddler on your own computer, follow the instructions on this document.

Test all scenarios (use cases). Make sure that you test error or error-like scenarios.


Saving – “exporting” – your tests

On the left side list of requests, you can delete items that you do not want included in the export.

When you’re ready to save, choose File > Export Sessions > All Sessions…

The export format will be “HTTPArchive v1.2”. Click the Next button to choose a save location (your project’s root, in the same folder level as the “packages” folder and specify a filename. Name the file by using the project name (e.g. “<whatever>.har”).

(You can test whether the export was successful. How? First, close then re-open Fiddler. Choose File > Import Sessions. Select “HTTPArchive” as the import format. Navigate to the folder that holds the “har” file, and select it. Finally, browse through the request-response sessions.)


Reminder about academic honesty

You must comply with the College’s academic honesty policy.

Although you may interact and collaborate with others, you must submit your own work.


Submitting your work

At this point in time, you should be familiar with the process:

  1. Copy your project
  2. Remove its packages, bin, and obj folders
  3. Zip and upload to the designated location on My.Seneca/Blackboard before the due date-and-time

If you need more details, look at the info in assignments 1 through 3.






























%d bloggers like this: