0 votes
in AWS by

You have a legacy application that works via XML messages. You need to place the application behind the API gateway for customers to make API calls.

Which of the following would you need to configure?

1 Answer

0 votes
by

Answer - B.

This is also mentioned in the AWS Documentation.

For example, suppose that an API has an application/json template defined for a request payload and has an application/xml template defined for the response payload.

If the client sets the "Content-Type : application/json", and "Accept : application/xml" headers in the request, both the request and response payloads will be processed with the corresponding mapping templates.

If the Accept:application/xml header is absent, the application/xml mapping template will be used to map the response payload.

To return the response payload unmapped, you must set up an empty template for application/json.

Since the documentation clearly mentions what should be the way to handle such requests, all other options are incorrect.

For more information on request-response data mappings, please refer to the below URL-

https://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html

To place the legacy application behind the API gateway for customers to make API calls using XML messages, you would need to work with Request and Response Data Mapping. Therefore, option B is the correct answer.

Explanation: API Gateway is a fully managed service provided by AWS that enables you to create, publish, monitor, and secure APIs at any scale. It supports multiple types of API endpoints like RESTful, WebSocket, HTTP, and Lambda function invocations.

When it comes to integrating a legacy application that works via XML messages, you need to configure the Request and Response Data Mapping in API Gateway to transform the incoming and outgoing XML payloads into a format that can be processed by the application.

The Request and Response Data Mapping can be done in several ways, such as:

  1. Using the mapping templates in API Gateway: API Gateway provides mapping templates that allow you to transform the incoming and outgoing payloads. You can create a mapping template that maps the incoming XML request to the format required by the application and similarly map the response received from the application to the XML format required by the client.

  2. Using AWS Lambda functions: You can use AWS Lambda functions to perform the data mapping. You can create a Lambda function that receives the incoming XML payload, transforms it into the required format, and sends it to the legacy application. Similarly, the Lambda function can receive the response from the application, transform it into the required XML format, and send it back to the client.

Regarding the other options:

  • Option A: Enabling Payload Compression is useful when you have large payloads to transmit, and you want to reduce the network bandwidth usage. However, it is not relevant to the given scenario.

  • Option C: Enabling CORS is necessary when you want to allow web pages hosted in a different domain to access the API resources. However, it is not relevant to the given scenario.

  • Option D: Enabling Multiple Stages is useful when you want to deploy multiple versions of your API in different stages, such as development, testing, and production. However, it is not relevant to the given scenario.

...