Forum Discussion
Hi Rupert,
I am also facing a similar problem but the difference is that I am not doing SOAPUI testing but I need to update the SOAPUI response tag values from an excel before forwarding that response to another system ,since my main application is developed in groovy ,I was thinking if this can be done in groovy only.
So my excel header are actually XPATHS and the corresponding rows below contain the value.
any help would be great.
Hi,
Ok, I am not sure I get exactly what you mean, please can you explain more? So you say you arent testing with SoapUI, but want to update tags in the response - are you calling some kind of service that returns XML and wanting to update the response based on values taken from an Excel spreadsheet?
Thanks,
Rup
- amitavban6 years agoNew Contributor
Hi Rupert,
Yeah ,so I have an inhouse built(java-groovy) application which generates a SOAP response and I have to feed that response to a proprietory software .But before sending the response to the software I need to update few tag values as per the Excel received from third party.
For now I have manually updated the third party Excel column headers with XPATHs of the XML so that I can update the XMLs as per the values in the corresponding row.
My main problem is reading the column header and passing its value in place of
Envelope.Body.CamCommand.CamAction.tCANOTIFICATIONS.pCASECIDUNDL
in the below code
String fileContents = new File(FilePath).text def xmlfromFile = new File(FilePath) def Envelope = new XmlSlurper().parseText(xmlfromFile.getText()) Envelope.Body.CamCommand.CamAction.tCANOTIFICATIONS.pCASECIDUNDL = "NewData123" XmlUtil xmlUtil = new XmlUtil() println xmlUtil.serialize(Envelope) xmlUtil.serialize(Envelope, new FileWriter(xmlfromFile))
Thanks,
Amitav
- VigneshSakkarai6 years agoNew Member
The below link is having an example, Hope this will help
https://github.com/Vignesh-Sakkarai/ParseAndUpdateXML/blob/master/MainXMLParser.groovy
Related Content
- 5 years ago
Recent Discussions
- 4 days ago
- 8 days ago
xml to soap
Solved8 days ago