Pawel_K
7 years agoRegular Visitor
Transfer multiple xml nodes form Response to different SOAP request
Hello,
I have problem with all "exportItems" nodes form SOAP respond
<exportItems> <ns2:id>0</ns2:id> <ns2:assetLogicalPath>DcNew</ns2:assetLogicalPath> <ns2:type>DOCUMENT_CLASS</ns2:type> <ns2:includeSubFolders>false</ns2:includeSubFolders> </exportItems> <exportItems> <ns2:id>0</ns2:id> <ns2:assetLogicalPath>DcNew2</ns2:assetLogicalPath> <ns2:type>DOCUMENT_CLASS</ns2:type> <ns2:includeSubFolders>false</ns2:includeSubFolders> </exportItems> <exportItems> <ns2:id>0</ns2:id> <ns2:assetLogicalPath>DcNew3</ns2:assetLogicalPath> <ns2:type>DOCUMENT_CLASS</ns2:type> <ns2:includeSubFolders>false</ns2:includeSubFolders> </exportItems>
to request:
<prom:CreateExportAssetsJob> <com:authContext> <com:UsernameToken> <com:domain> <com:ident> <com:name>${#TestSuite#name}</com:name> </com:ident> </com:domain> <com:userId>${#TestSuite#userId}</com:userId> <com:password>${#TestSuite#password}</com:password> </com:UsernameToken> </com:authContext> <exportItems> <mod:id>0</mod:id> <mod:assetLogicalPath>DcNew</mod:assetLogicalPath> <mod:type>DOCUMENT_CLASS</mod:type> <mod:includeSubFolders>false</mod:includeSubFolders> </exportItems> <exportDirectory>${#TestSuite#exportDirectory}</exportDirectory> </prom:CreateExportAssetsJob>
and I'm stuck, I worte groovy script but he only transfer the first "exportItems" but i need to transfer all of then can someone help me with that:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def child = groovyUtils.getXmlHolder("getAssetDependencies#Response") def holder = groovyUtils.getXmlHolder("createExportAssetsJob#Request") def node = holder.getDomNode("//exportItems") node.appendChild(node.getOwnerDocument().importNode(child.getDomNode("//exportItems"), true)) holder.updateProperty()