Getting XML with Grails REST plugin -
i'm having trouble working rest plugin in grails. trying convert xml request map in controller.
the data source trying data returns xml looks (this shortened simplicity):
<process id="345"> <correctedby>joanne w.</correctedby> <editby>joanne w.</editby> <editdate>2009-12-23 00:00:00.0 est</editdate> <produceby>stephen</produceby> <producedate>2010-01-14 00:00:00.0 est</producedate> </process>
in controller have code make request service
def getrest = { def wfrequest withhttp(uri: "http://myurl:8080") { wfrequest = get(path : '/application/controller/' + params.id, requestcontenttype: xml) { resp, xml -> render xml } } }
ok far, return data xml, tags gone:
joanne w.joanne w.2009-12-23 00:00:00.0 eststephen2010-01-14 00:00:00.0 est
can point me in right direction on how access xml returned request? i'd step through each kay value pair in "process" node of xml , populate map like
[correctedby: joanne w., editby: joanne w., editdate: 2009-12-23 00:00:00.0 est, produceby: stephen, producedate: 2010-01-14 00:00:00.0 est]
i'm finding rest plugin documentation little confusing, greatly appreciated.
thanks!
donald
it makes sense when render xml doesn't show tags. @ point, xml xmlslurper object, it's calling tostring().
so since have xmlslurper, need use it.
Comments
Post a Comment