Created
May 29, 2012 11:38
-
-
Save rbe/2827975 to your computer and use it in GitHub Desktop.
Groovy HTTP POST
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.5.0') | |
| import groovyx.net.http.* | |
| def postBody = new File('req.xml').text | |
| def http = new HTTPBuilder('http://localhost:8080/odisee/document/generate') | |
| try { | |
| http.post(path: "generate", body: postBody, requestContentType: groovyx.net.http.ContentType.XML) { resp -> | |
| assert resp.statusLine.statusCode == 200 | |
| println resp.statusLine | |
| } | |
| } catch (e) { | |
| println e | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment