How to avoid the content appearing within CDATA when doin a UpdateProperty() - Groovy Scripting

Apologies for posting a smiliar question to my earlier one Using Groovy Script in sopaUI - Copy the content of a XML Holder to Another (Trying to CLONE the SOAP request Test Step)

In my earlier question, I just realised that I had missed out mentioning my concern about CDATA ...which I think could have mislead in others understadning what my actual concern was. my bad!!

reiterating wat I had done.

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 the updated content is within the 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>

Could you please suggest how could I avoid updating the XML within CDATA. Rather update the XML properly. Kindly advice.

Answers


Change your Modified Request to:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"   xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">
   <soapenv:Header/>
   <soapenv:Body>${test123}</soapenv:Body>
</soapenv:Envelope>

And change your groovy to:

def grUtils = new com.eviware.soapui.support.GroovyUtils(context)
def ReqHolder2 = grUtils.getXmlHolder(context.expand( '${Original#Request#//idm:request}' ))
context.setProperty("test123", ReqHolder2.getXml())

testRunner.runTestStepByName( "Modified")

log.info(grUtils.getXmlHolder(context.expand( '${Modified#Request}')).getPrettyXml())

If you copy and paste the log into a text editor you will see:

Wed Jul 25 13:11:20 MDT 2012:INFO:<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: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>

Need Your Help

rich:calendar unknown event

jquery richfaces jsf-2.2

I have a rich:calender and I want to click (textbox) rich:calendar (so that it show me the calendar) using jqyery like