title: AWS API Gateway & Lambda Function for SOAP / REST Conversion
body: <p>I have a legacy application which currently utilises a SOAP interface to invoke functions against.</p>
  
  <p>I wish to serve this interface to a website, with it being preferential to be done using REST with a JSON scheme. </p>
  
  <p>I wish to get feedback and validate my thinking for the solution to this problem as described below:</p>
  
  <p>In order to do the transformation from SOAP (XML) &lt;--> REST (JSON) I am planning on using the following components:</p>
  
  <ul>
  <li><p>Amazon API Gateway: Receives a POST request from my website containing basic payload data.</p></li>
  <li><p>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.</p></li>
  <li><p>SOAP service: Receives request, executed required function and returns XML response</p></li>
  <li><p>Lambda Function: Receives response, parses any required data / handles any errors and returns the response call back to the API Gateway.</p></li>
  <li><p>API Gateway: Returns result of Lamdba function invocation.</p></li>
  </ul>
  
  <p>A few questions:</p>
  
  <ol>
  <li><p>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?</p></li>
  <li><p>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.</p></li>
  <li><p>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?</p></li>
  </ol>