IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  Transform JSON To XML In API Gateway

    Posted Wed November 30, 2022 08:04 AM

    Hi Everyone,

    I am using API Gateway version 10.15 and I am trying to transform my response from JSON to XML using XSLT in response processing policy. But my response is always in json despite of my payload. How can I transform my JSON response to XML. This is my XSLT.

    <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:strip-space elements="*"/>
    <xsl:output method="xml"/>
    <!-- Identity transform -->
    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="*[not(node()) or text() = 'null']"/>
    </xsl:stylesheet>
    

    #API-Gateway
    #webMethods
    #API-Management


  • 2.  RE: Transform JSON To XML In API Gateway

    Posted Wed November 30, 2022 08:36 AM

    What is the value passing in Accept header parameter in the request and give us the details about response policy defined for the API?


    #API-Gateway
    #API-Management
    #webMethods


  • 3.  RE: Transform JSON To XML In API Gateway

    Posted Wed November 30, 2022 08:45 AM

    In header Accept value is “/

    This is the payload defined in response processing.

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    
    <invoicedetails>
    <invoiceid>
    12345
    </invoiceid>
    <paymentreference>
    269467
    </paymentreference>
    <referenceid>
    fa51c8b6
    </referenceid>
    <externaltransactionid>
    2112
    </externaltransactionid>
    <receiver>
    ID:111/11
    </receiver>
    <creator>
    ID:111/11
    </creator>
    <amount>
    <amount>
    100.00
    </amount>
    <currency>
    EUR
    </currency>
    </amount>
    <status>
    <status1>
    PENDING
    </status1>
    
    </status>
    <creationdatetime>
    2022-11-29T15:24:27.920+01:00
    </creationdatetime>
    <lastupdatedatetime>
    2022-11-29T15:24:27.920+01:00
    </lastupdatedatetime>
    <expirydatetime>
    2022-11-29T16:24:27.920+01:00
    </expirydatetime>
    </invoicedetails>
    

    This is response processing configurations.


    #API-Gateway
    #API-Management
    #webMethods


  • 4.  RE: Transform JSON To XML In API Gateway

    Posted Wed November 30, 2022 09:01 AM

    See if this tutorial helps.

    It shows how json is transformed using XSLT.

    https://youtu.be/h670ZpoC-Zc


    #webMethods
    #API-Management
    #API-Gateway


  • 5.  RE: Transform JSON To XML In API Gateway

    Posted Wed November 30, 2022 09:34 AM

    Hi @franklinantony,

    Thank you for your response but this is JSON to JSON transformation. We need to transform JSON to xml


    #API-Gateway
    #API-Management
    #webMethods


  • 6.  RE: Transform JSON To XML In API Gateway

    Posted Wed December 07, 2022 11:16 PM