DPS907 WSA500 Lab 6

Working with internet media types. Hosted on Azure.

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


DPS907 WSA500 Lab 6 – Due Mon Oct 26

Due date: Monday, October 26, 2015, at 8:00am ET

Grade value: 5% of your final course grade

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

Yes, your project can earn part marks if a feature is missing. 



Enable a simple web service to work with internet media types; deployed to Azure.


Introduction to the problem to be solved

We need a simple app, to keep track of musical instruments. Assume that this app is needed by a company that sells musical instruments.

For this lab, there is a single entity, and it is not associated with another entity. The entity has properties to store a media item, a photo of the musical instrument.

Your work will be hosted publicly on Microsoft Azure Services.


Specifications and work plan

The following specifications apply to all of your work:

  • Follows best practices
  • Implements the recommended system design guidance
  • Uses Entity Framework and Code First technology

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

  • Accept (upload) and deliver internet media types (a photo)
  • Implement content negotiation
  • Deploy to Microsoft Azure Services

The in-class grading will look at the project structure, and your design model classes.

DPS907 students must configure the app to handle handle a sound clip media item, in addition to a photo media item.


Getting started

Download and install the “Web API project v2” project template that you learned about in the October 19 class notes.

Create a new project, named “Lab6”, based upon the above project template.

Build/compile before continuing.


DesignModelClassesDesign model class

This app needs only one entity class, probably named “Instrument”. Here’s some info about the purpose of the properties in your professor’s example solution:

Category – The musical instrument category. For example “Acoustic guitar”, or “Electric guitar”.

ManufacturerName – As it suggests, the manufacturer’s name. For example, “Gibson”.

InstrumentName – As it suggests, the full product name of the instrument. For example, “Leon Aubert Violin Outfit Model 50”.

ModelCode – The model code number, or part number. Alphanumeric.

MSRP – The manufacturer’s suggested retail price. Integer.

PhotoContentType – The internet media type of the photo.

PhotoMedia – The data bytes of the photo.

BSD students must also add:

SoundClipContentType – The internet media type of the sound clip. 

SoundClipMedia – The data bytes of the sound clip. 



At this point in the course, you probably follow a task checklist. If you don’t, create one. It will probably have some of these items on it:

  1. Change the localhost server port number (recommended)
  2. Edit the Home view and shared _Layout view with personalized information
  3. Update the data context to include the DbSet<TEntity> for the design model class(es)
  4. Author/create the resource model classes for each entity
  5. Write the AutoMapper create-map statements
  6. Create the entity-specific repository class(es), and add a property to the unit-of-work class
  7. Create the entity-specific controller
  8. Edit the “root” controller, so that it returns useful documentation to requestors

After learning this week’s topics, you may have a few more items to add to the checklist.


Entity-specific repository class

The class will have methods that do the following tasks:

  1. Get all
  2. Get one by identifier, which will also fetch the media item bytes
  3. Add new
  4. Set/configure the musical instrument’s photo
  5. BSD students: Set/configure the musical instrument’s sound clip


Controller work

The controller will implement the use cases that match the tasks you coded in the repository (above).

BSD students must write a controller method to set/configure the sound clip. Also, the “get one” method must be able to handle the photo and the sound clip. 

When a result returns an item or collection, it must use link relations.

Make sure that the public methods have XML Documentation Comments.


DPS907 (BSD) students will add support for a sound clip media item

As noted above, BSD students must configure the app to handle a sound clip media item, in addition to a photo media item.

It is not a difficult task, but it will require careful thought and planning.


Deploy your work to Microsoft Azure Services

Some of our course’s students have had problems deploying to Azure, after carefully following instructions. From your professor’s perspective, that was unexpected.

The plan to use “virtual applications”, to re-use the web app and database, has not worked for everyone. The reason behind the plan was to minimize the administrative workload in Azure, so that you could focus on web service programming.

Therefore, for this Lab 6, you can choose to continue using a virtual application (if the current process is working well for you), or use a new plan.


Continue using a virtual application 

Deploy your work to your “labs” web site on Azure, into the “lab6” virtual application. How?

Study this document, and watch its how-to videos.


New deployment plan

Create a new web app, and include “lab6” in its name. For example:


Create a new SQL database, and include “Lab6” in its name.  For example:


Create the new database inside the existing database server.

Then, deploy your Lab 6 work to this new target. Contact your professor if you have problems doing so.


If you are unable to deploy your work to Azure, then ask for help. Do not worry about “losing marks”, because Azure deployment is only one of several items on the checklist.

You must still submit your work (to My.Seneca/Blackboard) before the due date.


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 has already been configured. If you installed Fiddler on your own computer, follow the instructions on this document.

Test all scenarios (use cases), using your Azure-hosted web site, if possible.


Saving – ‘exporting’ – your tests

On the left side list of requests, you can delete items that you don’t 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 as the “packages” and “lab6” folder) and specify a filename. Name the file by using the project name (e.g. “lab6.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 “lab6.har”, 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 are familiar with the submission 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

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


























%d bloggers like this: