Reputation: 769
I have a legacy application which currently utilises a SOAP interface to invoke functions against.
I wish to serve this interface to a website, with it being preferential to be done using REST with a JSON scheme.
I wish to get feedback and validate my thinking for the solution to this problem as described below:
In order to do the transformation from SOAP (XML) <--> REST (JSON) I am planning on using the following components:
Amazon API Gateway: Receives a POST request from my website containing basic payload data.
Lambda Function: API Gateway invokes an AWS lambda function which is contains a soap client package. The function handles any necessary transformations and mappings and it is the Lambda function which issues the request to my legacy SOAP service.
SOAP service: Receives request, executed required function and returns XML response
Lambda Function: Receives response, parses any required data / handles any errors and returns the response call back to the API Gateway.
API Gateway: Returns result of Lamdba function invocation.
A few questions:
I am unsure whether it is the Lambda function which carries out the request directly to my SOAP service, I am assuming so as this is just an encapsulated function. Is this correct?
Does the Lambda function return the response back to the gateway request? I believe this is correct as the function can execute synchronously so will still have the context to return the response back.
Do you generally handle any authentication checks within the API Gateway for the initial inbound request or does the request in its entirety get passed down to the Lambda function where I would then conduct and execute any auth policies/checks?
Upvotes: 3
Views: 12576
Reputation: 19728
For Question 1 & 2: Yes, it is correct to do the SOAP request and transformation in the Lambda function.
For Question 3: To handle authentication at API Gateway, you can use a separate Lambda function called Custom Authorizer. You can also do authorization for API Gateway endpoints in Custom Authorizer Lambda function.
Upvotes: 6