Forum Discussion
Tony_Sheng
15 years agoOccasional Contributor
Hi Sushant,
If I am not wrong you are trying to get inner node values present inside a parent node. If it is so you can use something like this in your groovy script:
def requestName = 'YourSoap_RequestName';
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
holder = groovyUtils.getXmlHolder( requestName+"#Response" )
def parentNode = "rim:RegistryPackage";
arrItems = holder.getNodeValues( "//"+parentNode+"[1]/rim:ExternalIdentifier");
size = arrItems.size();
for(pos=1; pos<=size;pos++)
{
id = "${java.util.UUID.randomUUID()}";
holder.setNodeValue( "//"+parentNode+"[1]/rim:ExternalIdentifier["+pos+"]/@registryObject", id);
//holder.getNodeValue( "//"+parentNode+"[1]/rim:ExternalIdentifier["+pos+"]/@registryObject");
holder.updateProperty();
}
Following is the node taken for example:
<rim:RegistryPackage objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:RegistryPackage" status="Approved">
<rim:ExternalIdentifier identificationScheme="urn:uuid:75df8f67-9973-4fbe-a900-df66cefecc5a" registryObject="urn:uuid:8203387f-d4b1-4109-9c9d-fd8ece712be0">
<rim:Name>
<rim:LocalizedString value="XDSFolder.uniqueId"/>
</rim:Name>
</rim:ExternalIdentifier>
<rim:ExternalIdentifier identificationScheme="urn:uuid:f64ffdf0-4b97-4e06-b79f-a52b38ec2f8a" registryObject="urn:uuid:12345678-d4b1-4109-9c9d-fd8ece712be0">
<rim:Name>
<rim:LocalizedString value="XDSFolder.patientId"/>
</rim:Name>
</rim:ExternalIdentifier>
</rim:RegistryPackage>
Hope it might help you!
Regards,
Tony
If I am not wrong you are trying to get inner node values present inside a parent node. If it is so you can use something like this in your groovy script:
def requestName = 'YourSoap_RequestName';
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
holder = groovyUtils.getXmlHolder( requestName+"#Response" )
def parentNode = "rim:RegistryPackage";
arrItems = holder.getNodeValues( "//"+parentNode+"[1]/rim:ExternalIdentifier");
size = arrItems.size();
for(pos=1; pos<=size;pos++)
{
id = "${java.util.UUID.randomUUID()}";
holder.setNodeValue( "//"+parentNode+"[1]/rim:ExternalIdentifier["+pos+"]/@registryObject", id);
//holder.getNodeValue( "//"+parentNode+"[1]/rim:ExternalIdentifier["+pos+"]/@registryObject");
holder.updateProperty();
}
Following is the node taken for example:
<rim:RegistryPackage objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:RegistryPackage" status="Approved">
<rim:ExternalIdentifier identificationScheme="urn:uuid:75df8f67-9973-4fbe-a900-df66cefecc5a" registryObject="urn:uuid:8203387f-d4b1-4109-9c9d-fd8ece712be0">
<rim:Name>
<rim:LocalizedString value="XDSFolder.uniqueId"/>
</rim:Name>
</rim:ExternalIdentifier>
<rim:ExternalIdentifier identificationScheme="urn:uuid:f64ffdf0-4b97-4e06-b79f-a52b38ec2f8a" registryObject="urn:uuid:12345678-d4b1-4109-9c9d-fd8ece712be0">
<rim:Name>
<rim:LocalizedString value="XDSFolder.patientId"/>
</rim:Name>
</rim:ExternalIdentifier>
</rim:RegistryPackage>
Hope it might help you!
Regards,
Tony
Related Content
- 6 years ago
- 2 years ago
- 7 years ago
Recent Discussions
- 21 days ago