+1 (208) 254-6996 [email protected]

Subject: Distributed Computing

Deadline: 12 hours

Don't use plagiarized sources. Get Your Custom Essay on
Implement Communication VIA HTTP
Just from $13/Page
Order Essay

Language: PYTHON



We will continue working on our payment processing system described in the week 2 assignment. 

In week 4 we will cover communication between components of a distributed system. One of the great difficulties in communication is speaking the same language and even the same dialect of a given language. One of the easiest communication languages to use is the ubiquitous HyperText Transfer Protocol (HTTP) originally intended for communicating between a web browser and a web server. At its heart, this is nothing more than a list of key-value pairs. 


Have you ever stopped to consider what happens when you’re shopping online? In between entering your credit card information and the money getting charged to your account is a very complex set of interactions. During this class, we will explore a simplified payment processing system that does exactly this. We’ll create a design for it and provide sample implementations for some of the components. 

Let’s take a look at some of the details of a payment processing system. 


To keep this simple we’ll assume that we only accept credit cards for payment.


The happy shopper needs some way to enter their payment details.


The storefront needs an interface to the processing system where they can enter the shoppers’ details, get confirmation that they can charge the card, and collect the money afterwards.


Paying by credit card, whether online or in a physical shop, follows a two-step process. 

When your card is first run, it performs an “authorization”. This authorization takes the credit card details and the amount requested and sends them to the credit card company. The company then looks up the card and verifies whether or not the payment will succeed. A status code (OK or some kind of error code) is returned, along with an authorization code if the status is OK. 

Later on (e.g. once an hour, once a day) all of these authorizations are collected up into a single batch and sent as “payment requests” to the credit card company. A payment request contains the same information as the initial authorization along with the authorization code that was returned. The credit card company will respond with statuses for each payment request and all the money for those requests that succeeded is transferred into the store’s bank account.


The system needs to implement credit card processing as described above. 


We shall assume we use a single credit card processor and that processor provides us with an interface for performing authorizations in real time and batch payment requests.



For this assignment, you will write a short (1,000 – 2,000 words) paper on using HTTP to communicate between two servers and provide a small example by implementing a simple client and server in Python. Your example should demonstrate using HTTP to communicate between the client and the server using JSON. Your code can build off the example code you downloaded as part of the reading. The only thing you need to do is decide what data you want to transmit between the client and the server and how to encode it. There are lots of examples available. This can be as simple as creating a POST request where you send a JSON string to the server, and then have the server do something with the data and then respond with a JSON string in the body of the response. Python contains a json library to convert between a Python dict and a JSON string.

The description of the payment processing system is included above. One option for your communication would be to transmit an object that represents a payment request: credit card information, user information and payment amount.

For your paper you should do some research on different kinds of request / response bodies that are commonly used – we’ve already mentioned HTML form data and JSON but there are plenty more. You should provide an outline for what the client-server communication looks like and what HTTP headers are especially important.

Please keep focused on the goal of this assignment, which is to gain experience in communicating between two components of a system via a shared language understood by both components.

You must submit a zip file containing all of your source code (no executable code) and a 1,000-2,000 word write-up that describes your design and implementation, clearly explains how to run it, and covers problems you encountered and their solutions. (Links to an external site.)

Assignment Focus

You can find some additional JSON resources here:

1. A very approachable JSON tutorial (Links to an external site.)

1. Further JSON examples (Links to an external site.)

This assignment represents the creation of a “mock.” A mock is a mockup of a server with something simpler, which can stand in place of a real server. The advantages of a mock is that it is under the control of the application test team, and can provide known responses. Also, the actual interface have restrictions or invoke charges to the developer (think about an email server, for example).

Here are some specifics:

1. You may submit code in JavaScript/node, Java, or Python for this assignment

1. To align with the overall arc of the assignments, I suggest the following goal for your http exchange:

1. Implement the authorization exchange where the cardholder provides the credit card information (as specified in the use case, perhaps in a web form), and call the credit card service provider, which returns an authorization code (or failure).  

1. You can elide the second step request to the cardholder’s credit card issuer, implementing the credit card provider in the processing of the request. 

1. Implementing both a success and failure case would be ideal, perhaps using a credit limit as the criteria.

1. This assignment has a nice extension to use https, secure http, rather than unencrypted http. The extension and its credit is described below:

2. Wrap your http daemon in an TLS/SSL socket

2. Create a certificate (you may need openssl)

2. Start the SSL server

2. Use a browser to make the connection (and for now, allow the self-generated certificate to be trusted. Rescind later).

2. Use your “get” client to the SSL port to retrieve the JSON content

2. Convert the content to a dict and print it.

2. You may do the equivalent of (a) through (f) in Python, Java, or JavaScript 

2. A Python sample of wrapping the http server socket with TLS protocol is found in ssl_server.py

2. The bonus for this addition is up to a 20 point bonus

2. Please DO NOT submit your credential file (*.pem). Even though it is temporary, it should be kept private.

1. This assignment has a nice extension to locate the official port number for http and for https.


Working with JSON. 2019. MDN. Accessed 6 Feb 2020. https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON

JSON Examples. json.org. Accessed 6 Feb 2020. https://json.org/example.html


1. Submissions should be between 1,000 words and 2,000 words in length.

1. Refer to the UCOL Format and Style Requirements (Links to an external site.) on the Course Homepage, and be sure to properly cite your sources using Turabian Author-Date style citations (Links to an external site.).


Coding Rubric

Coding Rubric
This criterion is linked to a Learning OutcomeCode Functionality and EfficiencyThe classes created meet the design specification and therefore accomplish the task at hand. They are written with proper OOP techniques applied. The classes are set up with proper interfaces so they can collaborate with other classes and execute the necessary tasks. The code compiles without errors.80.0 pts
This criterion is linked to a Learning OutcomeCode QualityThe code satisfies all of the criteria in the coding standards. It contains only necessary variables. Variable names are meaningful. The code is well-formatted, easy to read and appropriately commented. The code includes proper error and exception handling.20.0 pts
This criterion is linked to a Learning OutcomeWrite-upThe write-up summarizes lessons learned, and any difficulties the student may have encountered. It also outlines any implementation decisions and the reasoning behind those.40.0 pts
Total Points: 140.0

Order your essay today and save 10% with the discount code ESSAYHELP