Forum Discussion

CCantrell's avatar
16 years ago

setNodeValue in Request

Based on the following code from the Help documentation

  def groovyUtils =
    new com.eviware.soapui.support.GroovyUtils( context )
  holder =
    groovyUtils.getXmlHolder( "Book Author Search#Request" )
  holder.setNodeValue( "//ns:SubscriptionId", ""+Math.random() )

I programmed the following groovy script:

  groovyUtils =
    new com.eviware.soapui.support.GroovyUtils( context );
  holder =
    groovyUtils.getXmlHolder("retrieveProduct#Request");
  holder.setNodeValue( "//v1:retrieveProduct/arg0", 2 );

where the Request node has the following content:

  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:v1="http://v1.ui.api.contract.svc.plad.ontsys.com/">
 

 
      1
 


However, when the script executes, I get the following error:

groovy.lang.MissingMethodException: No signature of method:
  com.eviware.soapui.support.XmlHolder.setNodeValue() is applicable
  for argument types: (java.lang.String, java.lang.Integer) values:
  {"//v1:retrieveProduct/arg0", 2}

Can someone explain why my code, which closely models the example code,  generates this error? I am able to successfully get the node value from the request. I am only unable to set it. Thanks.

1 Reply

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    the setNodeValue expects two string arguments, please try

    holder.setNodeValue( "//v1:retrieveProduct/arg0", "2" )

    or

    holder["//v1:retrieveProduct/arg0"] = "2"

    instead.

    regards,

    /Ole
    eviware.com