DataPower

DataPower

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.

 View Only
Expand all | Collapse all

Transform soap to jsonx using xslt

  • 1.  Transform soap to jsonx using xslt

    Posted Fri May 07, 2021 06:33 AM

    i have below soap

    ```

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">

    <soapenv:Header/>

    <soapenv:Body>

    <tem:Add>

    <tem:intA>5</tem:intA>

    <tem:intB>6</tem:intB>

    </tem:Add>

    </soapenv:Body>

    </soapenv:Envelope>

    ```

    and i want to convert this into jsonx

    i tried with this but this is wrong i am new to xslt

    ```

    <?xml version="1.0"?>

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" extension-element-prefixes="dp">

    <xsl:template match="/">

    <json:object xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx" xsi:schemaLocation="http://www.datapower.com/schemas/json jsonx.xsd">

    <json:string name="Add">

    <xsl:value-of select="//*[local-name() = 'intA']/>

    <xsl:value-of select="//*[local-name() = 'intB']/>

    </json:string>

    </json:object>

    </xsl:template>

    </xsl:stylesheet>

    ```

    please let me know how can i correct this



    #DataPower
    #Support
    #SupportMigration


  • 2.  RE: Transform soap to jsonx using xslt

    Posted Wed May 12, 2021 05:12 AM

    Hi,

    if you want to transform a "small" SOAP message into JSON it is just easier to generate the JSON directly without first doing the JSONx transform. Or is there a reason why you specifically want the JSONx format?

    --HP



    #DataPower
    #Support
    #SupportMigration