Event handler to trim CDATA from JMS response
I am looking for a way to remove CDATA from the XML response of my JMS Requests.
Thinking the best way to do this would be with an event handler but open to other suggestions.
I have this as a RequestFilter.afterRequest:
def content = context.httpResponse.responseContent
content = content.replaceAll( "<data contentType='null' contentLength='33173'><![CDATA[ï»¿", "")
content = content.replaceAll( "]]></data>", "" )
context.httpResponse.responseContent = content
I think part of the problem is the JMS Request response isn't an 'httpResponse' but I'm not sure how to identify the content in this context.
For some context, I am publishing a message via the MQTT test step and capturing the response message off a queue manager via JMS.
I am struggling to get the right property name for the JMS response.
I have this just to test:
def content = context.getProperty("JMS Response").getValue()
log.info( content )
but I am getting this error:
java.lang.NullPointerException: Cannot invoke method getValue() on null object
error at line: 2
On the left side of ReadyAPI, I can see the custom JMS Request Test Step Properties and the response property but not sure how to access it in groovy