Eviware Forum

General Category => eviware general => Topic started by: anu on January 26, 2008, 03:38:25 am



Title: need help with setNodeValue
Post by: anu on January 26, 2008, 03:38:25 am
Hi,

I am new to soapui. I am trying to write a groovy script to read the data from a file and pass them as parameters to the request in the next step.

my xml in the second step is as follows

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ses="http://xyz.com/klm/session">
   <soapenv:Header/>
   <soapenv:Body>
      <ses:open>
         <ses:company>bbb</ses:company>
         <ses:username>aa2</ses:username>
         <ses:password>2</ses:password>
         <ses:userIpAddress>10.20.30.40</ses:userIpAddress>
      </ses:open>
   </soapenv:Body>
</soapenv:Envelope>

my groovy script in the first step is as follows
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )

//create holder for last response an log requistID
def holder = groovyUtils.getXmlHolder( "ses:company#request" )

log.info holder.getNodeValue

holder.setNodeValue( "//ses:company", "ccc" )

holder.updateProperty()

This however is throwing an error
Fri Jan 25 18:37:00 PST 2008:ERROR:org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA

Can you pl. help me. I do not think I am doing it right.



Title: Re: need help with setNodeValue
Post by: omatzura on January 27, 2008, 11:52:42 am
Hi!

is "sec:company" really the name of your Request Test Step? ie as specified in the expression for getXmlHolder in

def holder = groovyUtils.getXmlHolder( "ses:company#request" )

which maybe should be something like

def holder = groovyUtils.getXmlHolder( "Test Request 1#request" )

?

regards!

/Ole
eviware.com