grails-plugins / grails-rest-client-builder

REST client plugin that uses Spring's RestTemplate
http://grails.org/plugin/rest-client-builder
Apache License 2.0
65 stars 32 forks source link

response .xml SAXParseException #35

Open SteWootten opened 9 years ago

SteWootten commented 9 years ago

When attempting to retrieve xml from the response a SAXParseException is thrown with Message: Content is not allowed in prolog.

def restBuilder = new RestBuilder()
def response = restBuilder.get("http://grails.org/api/v1.0/plugin/acegi/")
print response.xml

Works fine if I do

print response.json

Also doing

def response = restBuilder.get("http://api.openweathermap.org/data/2.5/weather?q=London&mode=xml")
print response.xml

just prints the String GB, which is the only text inside tags in the xml response. Furthermore

def response = restBuilder.get("http://api.openweathermap.org/data/2.5/forecast/daily?q=London&mode=xml&units=metric&cnt=1")
print response.xml

prints out LondonGB0.044, which is all the text inside tags within the xml response.

Any thoughts as to what is going on?