Forum Discussion

Gkm's avatar
Gkm
Contributor
8 years ago
Solved

How to get values from CDATA of JDBC request and compare it with Json Response

My JDBC request:

 

<Results>
   <ResultSet fetchSize="1288">
      <Row rowNumber="1">
	   <ConfigurationXML><![CDATA[<ROOT><StartDistance>0</StartDistance><Device>[{"Name":"CAM 1 ","Profile":{"ID":1,"Height":240},"Index":-1}]</Device></ROOT>]]></ConfigurationXML>
           <ID>25</ID>
           <UnitID>Gita</UnitID>
      </Row>
   </ResultSet>
</Results>

 My Json Response,

 

{
	"UnitConfiguration ": {
		"StartDistance ": 0,
		"Device ": {
			"Name ": "CAM 1 ",
			"Profile ": {
				"ID ": "1 ",
				"Height ": 240
				},
			"Index ": -1
		}
		
	}
        "ID":25,
        "UnitID":Gita

}

I'm unable to get values from CDATA 

 

 

4 Replies

  • We do have a script but it doesn't reflect changes on UI,

    Open the Project window, select the "Events" tab and add a RequestFilter.afterRequest handler. Set its content to:

     

    def content = context.httpResponse.responseContent
    content = content.replaceAll( "<!\\[CDATA\\[", "" )
    content = content.replaceAll( "]]>", "" )
    
    //log.info( content )
    
    context.httpResponse.responseContent = content

    If you add this you can use property expansion with JDBC.

     

     

     

    • Gkm's avatar
      Gkm
      Contributor

      Hey nmrao I'm unable to compare this JSON and DB with the script you share last time :smileysad:

       

      • nmrao's avatar
        nmrao
        Champion Level 3
        May be you want to open a new thread with the details as much as possible.