none
REST->SOAP. How does it work under the hood? RRS feed

  • Question

  • Hi, 

    I've just set up my first API Management endpoint. What's sitting behind it is a basicHttp web service. Using PostMan I am sending a POST request with the XML payload to the Management API endpoint and it works fine. 

    Unless I am missing something, basicHttp is essentially a SOAP endpoint, so the payload has to arrive at the the endpoint wrapped in the SOAP envelop. 

    How does the API Management figures this out that the underlying web service is basicHttp, so it the raw xml has to be converted to SOAP, etc... How does this magic happen?

    Thanks!


    • Edited by fly2 Friday, January 19, 2018 6:40 PM typo
    Friday, January 19, 2018 6:40 PM

Answers

  • Interestingly you might have discovered an accidental feature that I had never considered. 

    When you import a WSDL document into API Management, we generate inbound and outbound policies that use Liquid templates that handle the details of the SOAP envelope.  All the client needs to do is send the contents of the body and we map those contents into the SOAP envelope.  Usually people send JSON objects, but the Liquid template will happily bind to XML elements also, which I had never considered before.  I am curious if the response you see is JSON or XML.  I would expect it to be a JSON response.

    Hope that explains a little bit of the magic going on.


    Darrel

    • Proposed as answer by Swikruti Bose Saturday, January 20, 2018 5:27 AM
    • Marked as answer by fly2 Monday, January 22, 2018 5:16 PM
    Saturday, January 20, 2018 4:20 AM

All replies

  • Interestingly you might have discovered an accidental feature that I had never considered. 

    When you import a WSDL document into API Management, we generate inbound and outbound policies that use Liquid templates that handle the details of the SOAP envelope.  All the client needs to do is send the contents of the body and we map those contents into the SOAP envelope.  Usually people send JSON objects, but the Liquid template will happily bind to XML elements also, which I had never considered before.  I am curious if the response you see is JSON or XML.  I would expect it to be a JSON response.

    Hope that explains a little bit of the magic going on.


    Darrel

    • Proposed as answer by Swikruti Bose Saturday, January 20, 2018 5:27 AM
    • Marked as answer by fly2 Monday, January 22, 2018 5:16 PM
    Saturday, January 20, 2018 4:20 AM
  • Thank you, Darrel. The response in fact is as XMl as it can be.  I will do some more experimenting. The API management is awesome!

     
    Monday, January 22, 2018 5:18 PM