PLEASE HELP !!!!
How to append (insert) element repetition in the default request file ?
I have a "default request" as below:
/******************* Default request before repeat ***************************
<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="
http://xyz.ca/ebusiness/ProductServiceWrapper"
xmlns:prod1="
http://xyz.ca/ebusiness/ProductService">
<soapenv:Header/>
<soapenv:Body>
<prod:getDistProductDetails>
<prod:request>
<!--1 or more repetitions:-->
<prod1:ProdSet DestCountryCode="?" ContractNumber="?">
<!--Zero or more repetitions:--> <prod1:ProductServiceId>?</prod1:ProductServiceId> </prod1:ProdSet>
</prod:request>
</prod:getDistProductDetails>
</soapenv:Body>
</soapenv:Envelope>
****************************************************************************/
Now, I need to insert (repeatedly) the element
"ProductServiceId" 3 times which will look like:
/******************* Default request after repeat inserted *****************
<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="
http://xyz.ca/ebusiness/ProductServiceWrapper"
xmlns:prod1="
http://xyz.ca/ebusiness/ProductService">
<soapenv:Header/>
<soapenv:Body>
<prod:getDistProductDetails>
<prod:request>
<!--1 or more repetitions:-->
<prod1:ProdSet DestCountryCode="?" ContractNumber="?">
<!--Zero or more repetitions:-->
<prod1:ProductServiceId>?</prod1:ProductServiceId>
<prod1:ProductServiceId>?</prod1:ProductServiceId>
<prod1:ProductServiceId>?</prod1:ProductServiceId> </prod1:ProdSet>
</prod:request>
</prod:getDistProductDetails>
</soapenv:Body>
</soapenv:Envelope>
****************************************************************************/
How can I do it in Groovy ?
I have tried as below, but it is giving me an exception (I know, did something wrong

)
"Mon May 26 02:32:18 EDT 2008:ERROR:groovy.lang.MissingMethodException: No signature of method: groovy.util.NodeList.appendNode() is applicable for argument types: (java.lang.String, java.lang.String) values: {"prod1:ProductServiceId", "?"}"
My code snippet is:
/********************
...
...
def root = new XmlParser().parseText(newRequest)
root["soapenv:Body"]["prod:getDistProductDetails"]["prod:request"]["prod1:ProdSet"].appendNode("prod1:ProductServiceId", "?")
def writer = new StringWriter()
new XmlNodePrinter(new PrintWriter(writer)).print(root)
def result = writer.toString()
...
...
********************/