SOAP XML Parsing with Groovy.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2007
02:31 AM
07-27-2007
02:31 AM
SOAP XML Parsing with Groovy.
Hi,
Here is my SOAP Request:
33
Manipal
// //I need to get the Postcode value/text.so here is my Groovy Snippet To get the Postcode Text /Value ..But it didn't work...Because Of the presence of ":".
def output = ""
def rootNode = new XmlSlurper().parseText(xml)
rootNode.each {
output += it.text().trim()
}
log.info(output)
log.info(rootNode.soapenv:Envelope.soapenv:Header.soapenv:Body.web:GetUKLocationByPostCode.web:PostCode.text())
But the same code works fine with the Normal XML (i.e, Doesn't contain ":" ).
So, how to get the Postcode.
Regards,
Franky.
Here is my SOAP Request:
// //I need to get the Postcode value/text.so here is my Groovy Snippet To get the Postcode Text /Value ..But it didn't work...Because Of the presence of ":".
def output = ""
def rootNode = new XmlSlurper().parseText(xml)
rootNode.each {
output += it.text().trim()
}
log.info(output)
log.info(rootNode.soapenv:Envelope.soapenv:Header.soapenv:Body.web:GetUKLocationByPostCode.web:PostCode.text())
But the same code works fine with the Normal XML (i.e, Doesn't contain ":" ).
So, how to get the Postcode.
Regards,
Franky.
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2007
03:16 AM
07-27-2007
03:16 AM
Hi Franky,
have a look at the "Modification of request xml" example in our user-guide at http://www.soapui.org/userguide/functio ... t_Examples, it shows how to parse a message containing namespaces..
Alternatively go for the soapUI Pro version which contains a GroovyUtils class that makes this even easier.. check out http://www.soapui.org/userguide/functio ... roovyUtils
regards!
/Ole
eviware.com
have a look at the "Modification of request xml" example in our user-guide at http://www.soapui.org/userguide/functio ... t_Examples, it shows how to parse a message containing namespaces..
Alternatively go for the soapUI Pro version which contains a GroovyUtils class that makes this even easier.. check out http://www.soapui.org/userguide/functio ... roovyUtils
regards!
/Ole
eviware.com
