API Connect

 View Only
  • 1.  Discrepancy in response body

    Posted Sun January 02, 2022 06:49 AM
    Hello Team,

    We are creating REST API in APIC v10.We are getting difference in target url output and REST AOI output.
    When we invoke target url in API, "<![CDATA[ -----]]>" values are removed from output.

    Please find below output for reference.

    Target url output:
    <valueMap>
    <![CDATA[
    <tag name>value</tag name>]]>
    </valueMap>

    API url output:
    <valueMap>
    &lt;tag name>value&lt;/tag name>
    </valueMap>

    Kindly help to resolve this issue.

    ------------------------------
    Jyoti Yadav
    ------------------------------


  • 2.  RE: Discrepancy in response body

    IBM Champion
    Posted Mon January 03, 2022 02:57 AM
    What you are seeing here is a simple case of embedded XML:
    What you want for your URL is not the value of the CDATA field but the value field in the tag name in the CDATA field.
    So you must first extract the CDATA field as an XML and then extract the tag name value from said XML.
    Looking at your output you should not include the full valueMap tag in your URL.

    Enjoy

    ------------------------------
    Francois Brandelik
    ------------------------------



  • 3.  RE: Discrepancy in response body

    Posted Tue January 04, 2022 08:53 AM

    Hi Jyoti,
    Since you're using APIC v10, do you use a parse policy to parse the result of your invoke policy?  In DataPower, a parse of an XML payload that contains a CDATA section will produce a DOM where the CDATA is serialized with the proper escaping which is what you are seeing.  When the DOM is serialized to return to the client the CDATA is not reconstructed.  From a pure XML viewpoint, they are structurally equivalent.  APIC v10 will not parse the invoke policy response implicitly as was done in v5 (or in v10's v5 compatible gateway), so if you want the end result to contain the CDATA, just don't parse it.  If you need to parse it to extract and act upon some information in the XML, parse it but specify another context and extract it from there, leaving the message context alone.  The default for the parse policy is the message context which is eventually returned to the client.

    Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------