Structure of a Web Service Call
This topic explains what a web service call consists of and gives an example of a mapping with a call to an HTTP API.
The mapping shown below sends a GET request to an HTTP API to retrieve a product based on its ID and outputs the product's details to a JSON file.

The web service call component consists of two parts: Request and Response. The Request part enables you to supply data from the mapping to the web service. The Response part enables you to access the data returned by the web service and map it to other formats. In our example, the data returned by the service is mapped to a JSON file.
Request
The request contains several parameters and a request body.
Parameters
Parameters pass information that is needed for the server to process the request and return an appropriate response. Parameters can be of various types (e.g., path parameters, query parameters) and can serve different purposes (e.g., to filter, sort, and search data, pass authentication details).
In our example, the ID supplied to the HTTP request has the constant value of 2, which means we want to retrieve details of the product with this ID. Besides, the request contains two header parameters: Accept and Accept-Charset. The Accept parameter has the constant value of application/json, which refers to the content type MapForce wants to receive from the server. You can set parameters in the Web Service Call Settings dialog (see Parameters).
Body
In the web service call above, the structure of the request body is not set, because we only want to send a request, using header and template parameters. Defining the structure of the request body could make sense, for example, if you want to perform POST, PUT, and PATCH operations.
Response
The response part of the call contains a status code, headers, and a response body.
Status code
The HTTP status code is a three-digit number (e.g., 404) that is sent by the server to indicate the result of the request.
Headers
Headers provide important metadata about the response (e.g., the type of content being returned) and help MapForce understand how to process the response.
The response headers returned by the web service are mappable if they are additional headers (the ones which do not begin with Content). The Headers node of the response structure contains two child items: Name and Value.
Body
The response body receives content returned by the server. The appearance of the response body depends on the response structure you have selected.
Data at this level is binary-encoded, therefore, interacting with it directly requires MapForce mime functions. Note that you do not typically need to interact with the Body at all if the web service expects or returns structured data such as XML or JSON. Mapping data directly to or from the Body is only necessary if you call a web service that expects or returns unstructured content.
By default, the Body item is configured to parse the result if the HTTP status code ranges from 200 to 299. This means that the mapping will return an error for status codes greater than 299. Also, an error will be returned if the response cannot be parsed or the web service cannot be called due to connection failure or DNS resolution problems.
In some cases, you might want the mapping not to throw an error even if the HTTP status code is greater than 299. To do this, click the button next to the response Body and change the HTTP status code range. Alternatively, you can create multiple response Body items. For example, you can create one body that handles successful outcomes and another body that handles errors. For details about such a setup, see Error Handling in HTTP APIs.