Layer7 API Management

 View Only
  • 1.  Return Template response to requestor - XML

    Posted Feb 24, 2020 10:03 AM
    Hey There,

    While sending the json response to the requester.. I found the XML is returned. Can someone help me in fixing this..?

    <data contentType="application/soap+xml;charset=utf-8" contentLength="1044"><![CDATA[

    {

    JSON

    }

    </data>


  • 2.  RE: Return Template response to requestor - XML

    Broadcom Employee
    Posted Feb 24, 2020 10:47 AM
    Hi Pavansai,

    Can you share a sample of your policy? Are you simply using a return template response assertion to return the message body back to the requestor?
    The default content type for the return template response is XML. It would need to changed to JSON if this is how it is set up.

    Regards,
    Joe


  • 3.  RE: Return Template response to requestor - XML

    Posted Feb 25, 2020 01:30 AM
    The Policy Block
    Content Inside the block

    Response

    Please find the same.



  • 4.  RE: Return Template response to requestor - XML
    Best Answer

    Posted Feb 25, 2020 05:36 AM
    Edited by Christopher Hackett Feb 27, 2020 02:07 PM
    Most likely because you may have a response attribute somewhere created that has content-type set to xml .

    Select the tick box that send response immediately to see if you get a JSON response.

    Do you have any http route option where you have set value  the default 

    Probably it is giving the response variable content-type derived from here

    One way to overwrite it is create a response variable like this
    Then you dont need the return template option


    ------------------------------
    Pre-Sales Consultant
    CA Southern Africa
    ------------------------------