Forum Discussion

David_Shapiro's avatar
David_Shapiro
Occasional Contributor
11 years ago

Names with xsi:type=ns*:RemoteUser name values only needed

Hello,

I have xml soapui reponse with many xsi:type returns, but I only response from one with particular type.

For example,

The xml data:
...
<multiRef id="id5" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns7:RemoteUser" xmlns:ns7="http://beans.soap.rpc.jira.atlassian.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<email xsi:type="xsd:string">joe.smoo@fakemail.com</email>
<fullname xsi:type="xsd:string">Joe Smoo</fullname>
<name xsi:type="xsd:string">joesmoo</name>
</multiRef>
<multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns8:RemoteProjectRole" xmlns:ns8="http://beans.soap.rpc.jira.atlassian.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<description xsi:type="xsd:string" xsi:nil="true"/>
<id xsi:type="xsd:long">10002</id>
<name xsi:type="xsd:string">Administrators</name>
</multiRef>
...

I was using:


def request = testRunner.testCase.getTestStepByName(teststep);
def responseData = request.getProperty("Response");
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( "getProjectRoleActors#Response" );

def x = holder.getNodeValues("//multiRef/name");

for (def part in x) {
log.info part;
}

This returns all the name values even for the ones that are not listed with type RemoteUser.

I wanted something regular repression like with getNodeValue or getNodeValues, but no luck.

Things I tried with no success:

def x = holder.getNodeValues("//multiRef/ns:RemoteUser/name"); # says it is not declared

def x = holder.getNodeValues("//multiRef/RemoteUser/name"); # does not work
def x = holder.getNodeValue("//multiRef
  • /*RemoteUser*/name"); # does not work

    How can I get just the data with RemoteUser as the type?
  • 7 Replies