Webサービスをテストするのに、HTTP Builderを使ってみたら結構簡単にアクセスできた。
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1' )
import groovyx.net.http.RESTClient
import static groovyx.net.http.ContentType.*
// リクエストする先のURL
def http = new RESTClient('http://httpbin.org/')
// GETの場合
// パスとコンテンツタイプをMapで渡し、戻り値が結果
def res = http.get(path: 'get', contentType: JSON)
// 結果のJSONから一部表示
println res.data.origin
// POSTの場合
res = http.post(path: 'post', contentType: JSON)
println res.data.origin