Eviware Forum

soapUI => soapUI => Topic started by: mohbubur rahman on May 07, 2008, 09:20:46 am



Title: HTTP requests
Post by: mohbubur rahman on May 07, 2008, 09:20:46 am
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


Title: Re: HTTP requests
Post by: omatzura on May 07, 2008, 03:21:19 pm
Hi,

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

Code:
// 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


Title: Re: HTTP requests
Post by: mohbubur rahman on May 08, 2008, 02:58:01 am
Thanks Ole, I am new to SoapUI and Groovy scripts, where would be a good starting point for this?


Title: Re: HTTP requests
Post by: omatzura on May 08, 2008, 04:25:55 am
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/functional/groovystep.html.

Good luck :-)

regards,

/Ole
eviware.com


Title: Re: HTTP requests
Post by: mohbubur rahman on May 08, 2008, 04:56:31 am
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