cancel
Showing results for 
Search instead for 
Did you mean: 

getNodeValue is verry slow (10 seconds)

Highlighted
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
Highlighted
Super Contributor

Hi!

hmm.. can you show the entire script?

regards,

/Ole
eviware.com
Highlighted
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;
Highlighted
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
Highlighted
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
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors