Contributions
How to dynamically remove empty node from request xml in ReadyAPI?
Hello I have 1. A Data source with 2 columns (firstName, lastName) with a row of data 2. In one rowthe firstName is empty 3. I have a SOAP test with the Properties from the Excel mapped Now everytime the row with missingfirstNameis hit, it is introducing <firstName></firstName> in the request XML (which can only be seen from Raw view. XML view does not comntain the empty tag since I modified the SoapTest Property "RemoveEmptyContent" to true) and the response fails (since there is a rule that any of these firstName, lastName shouldeither do not have values or value of length 1 - 10). So the Request XML I am expecting is <customerSearchRequest xmlns="http://www.XYZ.net/services/customersearch"> <customerName> <lastName>Langley</lastName> </customerName> </customerSearchRequest> but it is taking <customerSearchRequest xmlns="http://www.XYZ.net/services/customersearch"> <customerName> <firstName></firstName> <lastName>Langley</lastName> </customerName> </customerSearchRequest> I followed the post and created aRequestFilter.filterRequest event and wrote the below code in the Edit section (I am using ReadyAPI) def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def stepName = context.getCurrentStep().getLabel() def holder = groovyUtils.getXmlHolder(stepName + "#Request") for( item in holder.getDomNodes( "//*[. = '']" )){ holder.removeDomNodes("//"+item.nodeName) } holder.updateProperty() context.requestContent = holder.xml But I am unable toremove<firstName></firstName> from the request. Where am I doing wrong?7 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.1KViews0likes0CommentsRe: Stripping dynamicly XML parrent tags with SoapUI PRO
Hello I have 1. A Data source with 3 columns (firstName, lastName) with a row of data 2. In one row the firstName is empty 3. I have a SOAP test with the Properties mapped Now everytime the row with missing firstNameis hit, it is introducing <firstName/> in the request XML (which can only be seen from Raw view) and the response fails (since there is a rule that any of these firstName, lastName shouldeither do not have values or value of length 1 - 10). So the Request XML I am expecting is <customerSearchRequest xmlns="http://www.XYZ.net/services/customersearch"> <customerName> <lastName>Langley</lastName> </customerName> </customerSearchRequest> but it is taking <customerSearchRequest xmlns="http://www.XYZ.net/services/customersearch"> <customerName> <firstName></firstName> <lastName>Langley</lastName> </customerName> </customerSearchRequest> I followed the post and created aRequestFilter.filterRequest event and wrote the below code in the Edit section (I am using ReadyAPI) def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def stepName = context.getCurrentStep().getLabel() def holder = groovyUtils.getXmlHolder(stepName + "#Request") for( item in holder.getDomNodes( "//*[. = '']" )){ holder.removeDomNodes("//"+item.nodeName) } holder.updateProperty() context.requestContent = holder.xml But I am unable toremove<firstName></firstName> from the request. Where am I doing wrong?7 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.6KViews0likes0Comments