Reputation: 15919
Hi there i am wondering how i can post a urlencoded string and read in an xml response using HTTPBuilder? I would like to use this inside a Grails application. The REST plugin is no option. I tried the examples given on http://groovy.codehaus.org/modules/http-builder/doc/post.html but this gives me no xml response to read in.
Upvotes: 0
Views: 2241
Reputation: 360
You can try something like this:
def httpBuilder = new HTTPBuilder("http://webite.url")
httpBuilder.request(Method.POST, URLENC){req->
headers.accept = "application/xml"
body = [ YOUR URL ENCODED POST]
response.success = {resp,xml->
//read xml response.
}
}
Upvotes: 1