Ask a Question

getNodeValue is verry slow (10 seconds)

rdebie
Contributor

getNodeValue is verry slow (10 seconds)

When i ask a value from a node it takes 10 seconds before i got an answer.

I have a large response and i use the follow syntax.

JiraKey = holder.getNodeValue(//multiRef[" + Counter + "]/key)

How can i speed up this syntax?

because i use this syntax in a loop and it taker 1:30 hours to get 500 nodeValues from a response.


I use a jira filter that gave me 500 Jira Issues. 500 Jira issues is for what we are doing normal. The most filters that we user give a result about 1000 jira issues.
4 REPLIES 4
omatzura
Super Contributor

Hi!

hmm.. can you show the entire script?

regards,

/Ole
eviware.com
rdebie
Contributor

import java.util.*

def ArrayList TotJiraIssue = new ArrayList();
def ArrayList Items = new ArrayList();
def ArrayList IssueIDs = new ArrayList();
def ArrayList IssueKeys = new ArrayList();

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "Ophalen Issue mbv FilterID#response" )


TotJiraIssue = holder.getNodeValues( "//getIssuesFromFilterReturn")
Items = holder.getNodeValues( "//multiRef")

Teller = 1
IssueTeller = 0

log.info("Aantal Issue ophalen : " + TotJiraIssue.size -1)
while (Teller <= Items.size)
{
  IssueKey = holder.getNodeValue("//multiRef[" + Teller + "]/key")
 
  if (IssueKey != null)
  {
      IssueID = holder.getNodeValue("//multiRef[" + Teller + "]/id")

      IssueIDs.add(IssueID);
      IssueKeys.add(IssueKey);
      IssueTeller++
      log.info("Aantal valide issues gevonden : " + IssueTeller)
  }

  Teller++;

  if (IssueTeller == (TotJiraIssue.size)-1)
      break
}

context.IssueTeller = 0;
context.IssueIDs = IssueIDs;
context.IssueKeys = IssueKeys;
omatzura
Super Contributor

Hi!

thanks.. performing a //XXX selection will take time on a large document since all nodes will have to be searched each time. Maybe you could "narrow the selection" by specifying all parent elements? ie

/soap:Envelope/soap:Body/xxx/yyy/zzz/multiRef

(or whatever prefix you soap envelope has)..

If that doesn't help significantly, please mail me a sample response you are selecting from so I can try to optimize this locally.. (ole@eviware.com)

regards,

/Ole
eviware.com
rdebie
Contributor

That did not solf the problem.
Ik can only speed up, when i write the response to a file an than, walk thru
the file. Monday i wil mail you the export of the respnse.

greetings
cancel
Showing results for 
Search instead for 
Did you mean: