Layer7 API Management

  • 1.  Reduce and convert XML response in PolicyManager

    Posted Jun 13, 2017 04:08 AM

    Hi

     

    I have an XML response that I want to reduce and then covert to JSON. How do I do that easiest? I have tried the xPath properties but that only gives me the value of the node back and not the whole node. 

     

    Example:

     

    <soapenv:Envelope>
       <soapenv:Body>
       <GetAccountsResponse >
          <ns1:Header>
             <tl:MsgId></tl:MsgId>
             <tl:SystemId>TDE</tl:SystemId>
             </ns1:Header>
          <ns1:GetAccountsResponseRecord>
             <ns1:Account>
                <tl:AccountNo>xx</tl:AccountNo>
               <tl:LastName>xx</tl:LastName>
               <tl:FirstName>xx</tl:FirstName>

    ....

     

     

    I want only the Account object and then convert 

    /A



  • 2.  Re: Reduce and convert XML response in PolicyManager
    Best Answer

    Broadcom Employee
    Posted Jun 13, 2017 10:15 AM

    Hi Andreas,

     

    You may want to try XSL instead, I believe you can use this to return a subset of the XML and then convert to JSON.

     

    Apply XSL Transformation Assertion - CA API Gateway - 9.2 - CA Technologies Documentation 

     

    Regards,

    Joe



  • 3.  Re: Reduce and convert XML response in PolicyManager

    Broadcom Employee
    Posted Jun 19, 2017 01:50 AM

    The xpath assertion should work, to return the whole node, should use responseXpath.element, not responseXpath.result, for more details, please refer to,

    Evaluate Response XPath Assertion - CA API Gateway - 9.2 - CA Technologies Documentation 

     

    Also, the Apply JSON Transformation Assertion - CA API Gateway - 9.2 - CA Technologies Documentation may help.