Layer7 API Management

  • 1.  Assertion to convert XML (including escape characters) into plain String

    Broadcom Employee
    Posted Feb 27, 2019 04:45 PM

    Hello 

     

    I am looking any custom assertion which can convert the XML (including the escape characters) into a plain string as shown:

     

    1. XML content below

    <a>

       <b>

          <c> hello </c>

       </b>

    </a>

     

    2. XML Converted into plain string including escape characters.

     

     

    &lt;a&gt;

    &lt;b&gt;

    &lt;c&gt; hello &lt;/c&gt;

    &lt;/b&gt;

    &lt;/a&gt;

    May be Encode/Code assertion can be extended to provide this feature in future product versions.

     

    Thanks

    Muthu



  • 2.  Re: Assertion to convert XML (including escape characters) into plain String

    Broadcom Employee
    Posted Feb 27, 2019 05:21 PM

    You can simply use regular expression assertion to replace particular char(s).

    Evaluate Regular Expression Assertion - CA API Gateway - 9.4 - CA Technologies Documentation 



  • 3.  Re: Assertion to convert XML (including escape characters) into plain String

    Broadcom Employee
    Posted Feb 27, 2019 06:14 PM

    THanks for your response.  Well this is what I am using currently, I wanted this feature to be rolled into Encode/Decode Assertion as one more item in the drop down as this is going to be a frequent requirement.

     

    In my usecase, I am required to update an XML in the cluster wide property using RESTMAN, unfortunately RESTMAN only accepts string formatted XML as a value for  <l7:Value> element, so without converting the XML to a proper string, this throws error.



  • 4.  Re: Assertion to convert XML (including escape characters) into plain String
    Best Answer

    Broadcom Employee
    Posted Feb 27, 2019 05:36 PM

    And just follow up, since guyd has module on git hub that does this, the links for it (and the compiled download) are on the "Idea"/Enhancement request page : 

     

     

    https://communities.ca.com/ideas/235738878-enhance-encodedecode-data-assertion-to-add-html-encodedecode?commentID=233981… 

     

    The enhancement still has only 4 votes, it would be nice to see it get more support, since this sort of escaping is essential for secure coding and be nice it have it in the core product - rather than doing regex pattern matches. 

     

    So please vote for it :-) 

     

    Cheers - Mark



  • 5.  Re: Assertion to convert XML (including escape characters) into plain String

    Broadcom Employee
    Posted Feb 27, 2019 06:15 PM

    THanks a lot Mark, I just voted for it.