cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Contributor

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 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

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

Is the below thread yours? Just happened to answer it. Please see if that helps.

http://stackoverflow.com/questions/38911400/how-to-extract-database-xml-data-in-soapui/38922768#3892...


Regards,
Rao.

View solution in original post

4 REPLIES 4
Highlighted
Staff

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

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.

 

 

 


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Hero

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

Is the below thread yours? Just happened to answer it. Please see if that helps.

http://stackoverflow.com/questions/38911400/how-to-extract-database-xml-data-in-soapui/38922768#3892...


Regards,
Rao.

View solution in original post

Highlighted
Contributor

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

Hey @nmrao I'm unable to compare this JSON and DB with the script you share last time Smiley Sad

 

Highlighted
Community Hero

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

May be you want to open a new thread with the details as much as possible.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Check out this week's challenge!

Create a script to generate an email when an assertion fails for the TechCorner tag!


Scripts created in July:
- A script to change the request body before sending it to the server
Top Kudoed Authors