singam19
15 years agoNew Contributor
Modify the responce and copy the node to the next request
HI
I am reading the response xml file and getting the node out of it .
Appeding the "permissions" to the extracted node.
Firststep:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
// get the xml to update(CORRECT)
holder=groovyUtils.getXmlHolder( testRunner.testCase.testSteps["GetPermissionsForUser"].testRequest.response.responseContent );
node = holder.getDomNode( "//ns4:GetPermissionsForUserResponse[1]/ns4:UserWithAssetPermissions[1]/ns5:PermissionMarkedAssetNode[1]/ns5:ChildNode[2]" )
//At this point it is printing the extracted node correctly(CORRECT)
log.info ("Printing the extracted node " +node)---VALUE1
use( DOMCategory )
{
// add new element "permission" to extracted node with "TOM" value
log.info "Argument:" + node.appendNode(new QName( "http://www.equinix.com/gse/service/schema/permission/entity/v2_2", "Permission"), "TOM" )
}
holder.updateProperty()
second step:
///Request file
holder1=groovyUtils.getXmlHolder( testRunner.testCase.testSteps["PersistPermissionsForUser"].testRequest.requestContent );
holder1.namespaces["ns5"] = "http://www.equinix.com/gse/service/schema/usermanagement/entity/v2_2"
holder1.namespaces["ns4"] = "http://www.equinix.com/gse/service/schema/permission/message/v2_2"
//copying the modified response node to the request.
holder1["//ns4:PersistPermissionsRequest[1]"]=holder["//ns4:GetPermissionsForUserResponse[1]"]
holder1.updateProperty()
however holder1 does not seem to get the holder values copied?Can you please help me.
I am reading the response xml file and getting the node out of it .
Appeding the "permissions" to the extracted node.
Firststep:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
// get the xml to update(CORRECT)
holder=groovyUtils.getXmlHolder( testRunner.testCase.testSteps["GetPermissionsForUser"].testRequest.response.responseContent );
node = holder.getDomNode( "//ns4:GetPermissionsForUserResponse[1]/ns4:UserWithAssetPermissions[1]/ns5:PermissionMarkedAssetNode[1]/ns5:ChildNode[2]" )
//At this point it is printing the extracted node correctly(CORRECT)
log.info ("Printing the extracted node " +node)---VALUE1
use( DOMCategory )
{
// add new element "permission" to extracted node with "TOM" value
log.info "Argument:" + node.appendNode(new QName( "http://www.equinix.com/gse/service/schema/permission/entity/v2_2", "Permission"), "TOM" )
}
holder.updateProperty()
second step:
///Request file
holder1=groovyUtils.getXmlHolder( testRunner.testCase.testSteps["PersistPermissionsForUser"].testRequest.requestContent );
holder1.namespaces["ns5"] = "http://www.equinix.com/gse/service/schema/usermanagement/entity/v2_2"
holder1.namespaces["ns4"] = "http://www.equinix.com/gse/service/schema/permission/message/v2_2"
//copying the modified response node to the request.
holder1["//ns4:PersistPermissionsRequest[1]"]=holder["//ns4:GetPermissionsForUserResponse[1]"]
holder1.updateProperty()
however holder1 does not seem to get the holder values copied?Can you please help me.