vijaydi
12 years agoContributor
Extracting values from JMS response using groovy
Hi ,
Below is the JMS response
I am using the below groovy to check if any value is being returned for <insertDocumentResponse> element.
however, the response I get for insertDocResponse property is <ns:insertDocumentResponse xmlns:ns="http://www.vedaxml.com/dms/1"/>
I would expect a null value but not sure why I get the above mentioned value for the insertDocResponse property.
Could you please advice how to extract values from the JMS response. I am thinking the groovy to extract values from a JMS response is slightly different to a SOAP response.
Thnaks heaps.
Below is the JMS response
<ns2:CMMMessage xmlns="http://www.vedaxml.com/dms/1" xmlns:ns2="http://www.vedaxml.com/cmm/1">
<ns2:header>
<ns2:headerEntry headerName="UUID">
<value xsi:type="xs:string" xmlns:ns3="http://www.vedaxml.com/dms/1" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">20130212-ID000-00001</value>
</ns2:headerEntry>
</ns2:header>
<ns2:body>
<insertDocumentResponse/>
</ns2:body>
</ns2:CMMMessage>
I am using the below groovy to check if any value is being returned for <insertDocumentResponse> element.
def insertDocResponse = context.expand( '${InsertDocument#Response#declare namespace ns1=\'http://www.vedaxml.com/dms/1\'; declare namespace ns2=\'http://www.vedaxml.com/cmm/1\'; //ns2:CMMMessage[1]/ns2:body[1]}' )
if(insertDocResponse == null)
{
testRunner.testCase.getTestStepByName("DataSink").setPropertyValue("DocResponse", 'NULL')
}
else
{
testRunner.testCase.getTestStepByName("DataSink").setPropertyValue("DocResponse", insertDocResponse)
}
however, the response I get for insertDocResponse property is <ns:insertDocumentResponse xmlns:ns="http://www.vedaxml.com/dms/1"/>
I would expect a null value but not sure why I get the above mentioned value for the insertDocResponse property.
Could you please advice how to extract values from the JMS response. I am thinking the groovy to extract values from a JMS response is slightly different to a SOAP response.
Thnaks heaps.