cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Builder support

Highlighted
Not applicable

HTTP Builder support

Hello,

I'm attempting to use HTTPBuilder ( http://groovy.codehaus.org/modules/http-builder/ ) from inside a groovy script step.
I have added the http-builder-0.7-20130216.204411-3.jar file to bin\ext but when I run one of the sample scripts I receive this error. http://screencast.com/t/b3SUWVERdU0
Anyone have any ideas? I've used this library before outside of SoapUI and didn't have this problem.

The end goal is to use the script to login and generate the authentication cookie that I can then use for my tests...

Thanks!
2 REPLIES 2
Highlighted
Occasional Contributor

Re: HTTP Builder support

hello,

I am in a similar situation, by any chance did you figure out how to send request from your groovy script.
Highlighted
New Contributor

Re: HTTP Builder support

I managed to send a http request through groovy script in SoapUI 5.4.0, bu putting the following jars in the lib folder: http-builder-0.6.jar antlr-2.7.7.jar appengine-api-1.0-sdk-1.3.8.jar asm-3.2.jar asm-analysis-3.2.jar asm-commons-3.2.jar asm-tree-3.2.jar asm-util-3.2.jar ezmorph-1.0.6.jar signpost-commonshttp4-1.2.1.1.jar signpost-core-1.2.1.1.jar xml-resolver-1.2.jar

Maybe not all of them are necessary, let me know if some of them can be removed without harm.

The script I used is the following:

import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
import org.apache.http.auth.*

def http = new HTTPBuilder( 'http://tch-testrail01/testrail/index.php?/api/v2/add_result/435517' )
http.request( POST, JSON ){ req ->
body = [status_id:1, comment:'passed']
headers.'Content-Type' = 'application/json'
headers.'Authorization' = 'Basic ' + 'user:password'.bytes.encodeBase64().toString()
response.success = { resp, json ->
log.info json
}
}
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors