Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8285049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:20:01+00:00 2026-06-08T11:20:01+00:00

I am a newbie to groovy scripting and seeking your help to find a

  • 0

I am a newbie to groovy scripting and seeking your help to find a solution to the issue I am facing at the moment.

My requirement is that, on each iteration based on the test data input, I will have to remove a particular node or certain nodes from the SoapRequest. In order to achieve that I created two identical SOAP Request -Original and Modified.

Using groovy script I am trying to restore the content of the modified soap request with the content of the original soap request after each iteration. (Iteration 1 – Node to delete is and in second iteration node to delete is keeping – This is the reason for restoring the request with the original content). In other words want to clone the soap request so that the delete node operations can be performed on the cloned request keeping the original request unchanged.

The below are my Teststeps under my TestSuite.

Datasource
Original (SoapRequest)
Groovy Script.
Modified (SoapRequest)

SoapRequest (Original)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <idm:request>
         <idm:dataset-searches>
            <idm:profile-name></idm:profile-name>
         </idm:dataset-searches>
         <idm:individual-name>
            <idm:family-name>ABC</idm:family-name>
            <idm:first-given-name>DEF</idm:first-given-name>
         </idm:individual-name>
         <idm:date-of-birth>1985-12-12</idm:date-of-birth>
      </idm:request>
   </soapenv:Body>
</soapenv:Envelope>

My Groovy Script is as below

def grUtils = new com.eviware.soapui.support.GroovyUtils(context)
def ReqHolder2 = grUtils.getXmlHolder("Modified#Request")

ReqHolder2.removeDomNodes("//idm:request")
ReqHolder2.updateProperty()

ReqHolder2 ["//soapenv:Body"] = context.expand( '${Original#Request#//idm:request}' )
ReqHolder2.updateProperty()

When I execute the above groovy script, the Modified request is updated with the content from the Original request but with CDATA and reference to the schema.

SoapRequest (Modified)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">
   <soapenv:Header/>
   <soapenv:Body>***<![CDATA[<idm:request xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">***
         <idm:dataset-searches>
            <idm:profile-name/>
         </idm:dataset-searches>
         <idm:individual-name>
            <idm:family-name>ABC</idm:family-name>
            <idm:first-given-name>DEF</idm:first-given-name>
         </idm:individual-name>
         <idm:date-of-birth>1985-12-12</idm:date-of-birth>
      </idm:request>**]]>**</soapenv:Body>
</soapenv:Envelope>

I would greatly appreciate if someone could help me with this. Also, I would be glad to know/learn other alternative ways in groovy to implement this requirement.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:20:04+00:00Added an answer on June 8, 2026 at 11:20 am

    Consider reading on Groovy XmlSlurper and XmlParser. They are very simple to implement and you could use them for your xml manipulation. However, for your particular requirement, using XmlParser would make more sense.

    Here is a different question and my answer, just to help you get an idea of how XMLParser works

    And since your question is more about deleting nodes and less about accessing/validating them. Here is an other question on SO about deletion of nodes using XMlParser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie asking for help: I have an array of numbers that needs to be
newbie here, so thanks in advance for help! I have a Wordpress site with
Newbie question: I just installed VisualSVN Server and created a repository. I noticed that
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Newbie: help switching locale with JSF Hi, I hope someone can help, I am
Newbie alert! OK, I have a working central Mercurial repository that I've been working
Newbie C++ programmer here. I'm trying to write a command line application that takes
Newbie here. I am looking at company code. It appears that there are NO
I am a newbie at Groovy and I want to modify one example I've
Being an (extreme) newbie to grails/groovy/maven/tomcat etc, I endeavoured to set up a CentOS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.