Eviware Forum

soapUI => soapUI => Topic started by: John R. Brewster on August 19, 2008, 04:54:20 pm



Title: Inserting XML
Post by: John R. Brewster on August 19, 2008, 04:54:20 pm
I apologize ahead of time for being new to XML and SoapUI and for not using the correct terminology.

However, I am trying to do the following from an Groovy Script.

1 - Read a Response and Grap all the information between a tag. (for example everything between <Addresses>...</Addresses>

2 - REMOVE everthing between a tag (ie <Addresses>...</Addresses> in a different Request and then STUFF everhting I got in step 1) and put it into the now empty <Addresses></Addresses> of Step 2.

I just don't know where to start with that.  I have looked thru Groovy and SoapUI and tried a few things using XmlParser and XmlHolder, but not getting it done.

Thanks for any help.
--Jb


Title: Re: Inserting XML
Post by: omatzura on August 20, 2008, 09:24:06 pm
Hi John,

Maybe you can achieve this without a groovy script;

1) Create a property-transfer that selects the addresses element and transfers it to a property in a properties-step, for example named "addresses"
2) Expand that property in your request with

${PropertiesStep#addresses}

In this setup the addresses will first be copied to the property, and then inserted into the outgoing request..

Does that suffice?

regards!

/Ole
eviware.com


Title: Re: Inserting XML
Post by: John R. Brewster on August 25, 2008, 06:41:14 pm
I tried this.  However, what was happening was I was getting one parent tag too many (Only wanted the children) and I was blowing away the Parent node where I was trying to put it.  I wanted the children to go into the parent of the resulting doc without the parent of the requesting doc.  If that makes sense.

for example:
What I had
<foo>
 <fooChild>
 <fooChild>
</foo>

<bar>
 <bazChild>
 <bazChild>
</bar>

What I wanted in the END:
<bar>
 <fooChild>
 <fooChild>
</bar>