cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP requests

Contributor

HTTP requests

Hi,

Can you tell me if SoapUI supports HTTP requests, specifically a GET command? If so can you explain how I would do that.

Regards,

Moks
4 REPLIES 4
Super Contributor

Re: HTTP requests

Hi,

You'll need to create a groovy-script for this, something in the line of

// create request
def getMethod = new org.apache.commons.httpclient.methods.GetMethod( url )

// get httpclient
def httpClient = com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.httpClient

// send it
httpClient.executeMethod( getMethod )

// process response
def response = getMethod.responseBodyAsString
...


regards,

/Ole
eviware.com
Contributor

Re: HTTP requests

Thanks Ole, I am new to SoapUI and Groovy scripts, where would be a good starting point for this?
Super Contributor

Re: HTTP requests

Hi,

ok.. the groovy website has a good introduction to the language, have a look at http://groovy.codehaus.org/Getting+Started+Guide. The script would have to be placed in a Groovy Script Step in your soapUI TestCase, read more about this at http://www.soapui.org/userguide/functio ... ystep.html.

Good luck :-)

regards,

/Ole
eviware.com
Contributor

Re: HTTP requests

Thanks Ole, I was able to perform this action.

The http request is sent based on the response recieved for a soap request. Based on the time range specified, the response will have n' elements that I require using http request for.

E.g. If I specify time from 08:00-12:00, this will create 3 elements. I am using Xpath (...\\elementName), this should give me all occurences of this element (not able to prove yet). I need to use th Groovy script to iterate through each of these element and send a http request. I have been able to use while statement. But how would I iterate though the captured property?

Moks
New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors
Top Kudoed Posts