Wednesday, June 14, 2017

How to configure Amazon API Gateway as a SOAP webservice passthrough in minutes

Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure REST/HTTP-style APIs at any scale. Unfortunately, there's no clear out-of-the box support for SOAP APIs. For enterprise that still lean heavily on SOAP and want to expose their webservices via Amazon API Gateway, this small recipe might help push things in the right direction.

Configure the API

  1. Enter the Amazon API Gateway console and create a new API. Then, create a POST method.
  2. In the Method Request configuration page, create the following three http-headers: Accept, Content-Type and SOAPAction (note that not all SOAP webservices require a SOAPAction).
  3. In the Integration Request config page set:
    • Integration type: HTTP
    • Method: POST
    • Endpoint URL: SOAP endpoint of the SOAP service you're exposing. For this recipe, I'm using the free GetCountries webservice from webservicex.net which simply returns a list of countries.
    • Content-handling: passthrough
    • Body Mapping Templates: 'When there are no templates defined (recommended)'
  4. In the Integration Response config page, method response status '200' row:
    • Content-handling: Passthrough
  5. In the Method Response config page: 
    • Response Body for 200, set response model content-type to: text/xml

Test using Amazon API Gateway Method Tester

With the Method Test tool it's very easy to test your configuration. Just click on the Test link. In the next page, put in the correct header values. To get the correct values quickly, use a tool like SoapUI and check out the raw message. In here, you'll find the header values of the SOAP-requestmessage. Put in a request body string and fire your request. A Response Body will return in the right textfield.


Deploy the API

When you're done testing, deploy your API by clicking on 'Deploy API'. A public API endpoint will be returned. You can use the SoapUI project that you used during testing and replace the SOAP endpoint with the API Gateway endpoint. When everything's configured OK, a proper SOAP response will return.


** Please note that no production testing has been performed by me using below config so you might want to do your own feasibility study first! **







1 reacties:

santhosh kumar said...

Nice info regarding amazon api gateway my sincere thanks for sharing this post Please Continue to share this post
Cloud Computing Training in Chennai

Post a Comment