cancel
Showing results for 
Search instead for 
Did you mean: 

How to send http POST Request from ServiceV PRO

Highlighted
Occasional Contributor

How to send http POST Request from ServiceV PRO

Hi,

Have created response in servicev pro.once I fire the request request from client, the http post request for another service should come after a response. Please provide a solution (script) ASAP.

5 REPLIES
Community Hero

Re: How to send http POST Request from ServiceV PRO

Hi,

 

Can you describe your desired scenarion with more details step by step to make it more clear?

 

> http post request for another service should come

By definition, request is issued by the client to the server. Thus, request cannot be returned. Also note, that http is based on the 'request-response' scheme and they are in the one-to-one relation. I.e. only one response can and must be returned for the given request.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: How to send http POST Request from ServiceV PRO

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.

Community Hero

Re: How to send http POST Request from ServiceV PRO

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.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: How to send http POST Request from ServiceV PRO

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

Community Hero

Re: How to send http POST Request from ServiceV PRO

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.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Top Kudoed Authors
Are You In?

Meet the Community Leaders!

SmartBear Connect is an excellent opportunity for training, in-person support, and networking.

GET YOUR TICKET WITH $100 OFF