Comparing the client to the server
Comparing the code between the RESTful calculator client and server.
The purpose of this side-by-side comparison is to provide a glimpse of how the client code and
the server code relate. In some cases, only the initial line of server code has been provided; you
can look at the full source for either the client or the server for the complete code.
| Calculator client | Calculator server | 
|---|---|
The client creates the HTTP request, which is a URL consisting of a path and parameters.  | 
The server parses out the path and the query from the HTTP service request.  | 
The client sets the method with the verb "GET".  | 
The server parses out the method verb from the HTTP service request.  | 
The client sets the Content-Type header request.  | 
The server parses out the value of the Content-Type header request.  | 
The client sets the Accept header request.  | 
The server parses out the value of the Accept header request.  | 
The client submits the request.  | 
The server receives the HTTP service request.  | 
The client: 
 Note: This example is for JSON; if the data is XML instead, then the methods
 
doXmlRequest() and getXmlResponse() would be used instead of
getting a text response and JSON parsing. | 
The server returns a response to the client.  |