Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: HTTPBuilder-0.5.0
-
Fix Version/s: None
-
Component/s: HttpBuilder
-
Labels:None
-
Environment:Windows XP, JDK 6, Groovy 1.7.2
-
Number of attachments :
Description
I am invoking remote RESTful service via HTTP POST. The response is returned properly (I have enabled debug logs). It contains a single element within the root and than a flat structure of other elements:
<TwilioResponse>
<SMSMessage>
<Sid>SMbd7f14baa4c6a718002558f92cbca3d5</Sid>
<DateCreated>Thu, 20 May 2010 09:57:32 -0700</DateCreated>
<DateUpdated>Thu, 20 May 2010 09:57:32 -0700</DateUpdated>
<DateSent/>
<AccountSid>removed</AccountSid>
<To>removed</To>
<From>4155992671</From>
<Body>Test</Body>
<Status>queued</Status>
<Flags>4</Flags>
<Price/>
</SMSMessage>
</TwilioResponse>
The typical slurper access notation doesn't work:
println response.data.SMSMessage.Sid.text()
It results in an exception: Caught: groovy.lang.MissingPropertyException: No such property: SMSMessage for class: groovy.util.slurpersupport.NodeChild
Using the exactly same XML for manual parsing via XmlSlurper, everything works fine. I also find out I can crawl thru the tree via methods like response.data.children().each (although there is just one). In this case however I run into the same problem on the next level of elements.
I can't imagine off the top of my head why it would behave this way. Any chance you can provide some example code so I can dig into it??