Layer7 API Management

  • 1.  How can i customize a xml content to a specific extent

    Posted Jul 29, 2017 03:21 PM

    Hello Everyone,

     

    I am getting a request in the below format from a database using JDBC query

    They are recurring. As shown below is the one set of values there will be n number of sets which we dont know 

     

      <L7j:row>
    <L7j:col name="asub" type="java.lang.String">CONQP</L7j:col>
    <L7j:col name="asset" type="java.lang.String">CNE</L7j:col>
    <L7j:col name="esc" type="java.lang.String">AAN</L7j:col>
    <L7j:col name="date" type="java.sql.Timestamp">2017-03-29 14:32:11.0</L7j:col>
    <L7j:col name="by" type="java.lang.String">KXT=08</L7j:col>
    <L7j:col name="acry" type="java.lang.String">COQP</L7j:col>
    <L7j:col name="modby" type="java.lang.String">CLOVPPORT</L7j:col>
    <L7j:col name="mel" type="java.lang.String">ACANE</L7j:col>
    <L7j:col name="avdt" type="java.sql.Timestamp">2017-03-29 00:00:00.0</L7j:col>
    <L7j:col name="crete" type="java.sql.Timestamp">2001-12-12 17:53:30.0</L7j:col>
    <L7j:col name="ldc" type="java.lang.String">AANE</L7j:col>
    <L7j:col name="me" type="java.lang.String">AE</L7j:col>
    </L7j:row>

      <L7j:row>
    ${SAME AS ABOVE COLUMN BUT WITH DIFFERENT VALUES }
    </L7j:row>

     

    I need to customize it to a below format

     

      <L7j:row>
    <asub>CONQP</asub>
    <asset>CNE</asset>
    <esc>AAN</esc>
    <date>2017-03-29 14:32:11.0</date>
    <by>KXT=08</by>
    <acry>COQP</acry>
    <modby>CLOVPPORT</modby>
    <mel>ACANE</mel>
    <avdt>2017-03-29 00:00:00.0</avdt>
    <crete>2001-12-12 17:53:30.0</crete>
    <ldc>AANE</ldc>
    <me>AE</me>
    </L7j:row>

      <L7j:row>

    Same as above with different values.

    <L7j:row>

     

     

    AS I need to customize it to above format because it will be easy to convert in to json as backend accepts only json 

     

    {

    "asub":"CONQP",
    "asset":"CNE",

    "esc":"AAN",
    "date":"2017-03-29 14:32:11.0",
    "by":"KXT=08",
    "acry":"COQP",
    "modby":"CLOVPPORT",
    "mel":"ACANE",
    "avdt":"2017-03-29 00:00:00.0",
    "crete":"2001-12-12 17:53:30.0",
    "ldc":"AANE",
    "me":"AE"

    }

     

    Problem is i am not able to convert the xml packet which is comming to gateway into the required json format which backend needs.

    The above are 12 tags elements which will but they are recurring 

     

    Please suggest what i can do to meet the requirement.

     

    So Please help on this 



  • 2.  Re: How can i customize a xml content to a specific extent
    Best Answer

    Broadcom Employee
    Posted Jul 30, 2017 08:49 PM
      |   view attached

    Hello irfan.mugale ,

    XSLT will work.

    I attach an example here .

     

    Regards,

    Mar

    Attachment(s)



  • 3.  Re: How can i customize a xml content to a specific extent

    Posted Jul 31, 2017 07:18 AM

    Hi Zhijun,

     

    Thank you for your help.

    The shared policy solved my issue.

     

    Regards,