Forum Discussion
Hi Alex,
Thanks for your reply,
I need to send a http post request along with the url from SERVICEV PRO. I need groovy script for this requirement.
HI,
I am still not sure what you are looking for.
ServiceV is a piece of software that makes it possible to intelligently emulate a web service (web API) and acts as a web server. Which means that it waits for the request from the client, dispatches obtained request according to the designed dispathing scheme and replies with the specified response. I.e. like the regular web server, ServiceV does not send requests but responds to the obtained ones.
You may use any software that is capable to send appropriate requests as a client that sends requests to the service emulated using ServiceV. For example: SoapUI, regular web browser, Swagger Inspector (https://inspector.swagger.io/builder), etc.
- PriyankaP7 years agoContributor
There are my Requirement
Step 1 : Created virtual service for service1
step 2: When hitting from client(soapui) getting response
Step3 : After 5 min from response of Service 1 ,I should get http post request xml for a a service 2 from serviceV PRO
Have tried some scripts in After request script option in ServiceV PRO
EX:
def doGET() {
try {
def http = new HTTPBuilder('http://soundly.me')
http.get( path : '/endpoint', query : [helowrld:'hi!'] )
{ resp ->
return resp.entity.content.text
}
}
catch(groovyx.net.http.HttpResponseException e)
{
println e.toString()
}
}
println 'doGET(): ' + doGET()
But no luck on this- AlexKaras7 years agoChampion Level 3
Hi,
OK, one more time: ServiceV is an application that emulates web service running on web server. By definition, web server does not send requests but serves received ones and replies with responses. Thus, like any web server, ServiceV does not send requests. Point.
If the backend of your tested application implements the scenario that you mentioned, then this means that the backend actually consists from web server that responds to requests and web client that sends requests. And the tested client application consists of the same two parts: web client that sends initial request and processes obtained response and web server that processes obtained requests.
The backend must implement some sort of queue that is used to signal to the backend's web client to issue the request when backend's web server receives and processes initial request from web client.
Note, that web server must reply to the obtained request immediately, while subsequent request from backend web client in your scenario is issues in 5 minutes. This means that those two events (initial request processing and folow-up request generation) are loosely coupled.
With the above in mind, the possible design that I see is like this:
-- You need to create a code in ServiceV that will prepare data required to issue request by the backend web client and will store these data into some queue/storage (e.g. to the file);
-- ServiceV responds to the obtained initial request from web client in a usual way;
-- You will need to implement some application that will act as backend web client. This application will process the queue/storage and will issue request when there are data in the queue/storage.
Related Content
Recent Discussions
- 3 hours ago
- 17 days ago