post JSON to Micorservice using virtual assets
I have a Micro service up and running i want to post my JSON file to that micro service using parasoft virtualise, could you please help me, i was thinking i should use message proxy but I got lost somewhere
benken_parasoft Posts: 1,143 ✭✭✭
The REST Client tool can post JSON. In a virtual asset (pva), you could chain it to Message Responder, for example. There is also a Message Forward tool in case you need to forward the original incoming request to another service endpoint.0
Is the goal to always send a request to the microservice when a request is received? In that case, a Messaging Client or a REST Client might be more appropriate. You would have to build the request though.
The Message Forward tool only is executed if the Responder fails to find a matching response message. What is probably happening is the response is matching so the forward tool is never triggered. To always run the forward tool put the Responder into "Multiple Responses" mode and don't define any response messages. Then the forward tool will run and the response will be the response from the microservice.
Use a Client tool for when you want to send a different response back from the asset but always want to invoke the microservice.
Use a Message Forward tool when you want to the responder to forward its request to the microservice and reply with the response from the microservice.
Hope this helps!0
The suggestion from @benken_parasoft will work if you are posting JSON to the microservice as a response to an incoming request to Virtualize. If instead you are just trying to test your microservice, then you need to use a REST Client in SOAtest.0
thanks for the response @benken_parasoft i tried using Message forward
but It's not sending the JSON payload to target REST endpoint, can you please help me what wrong I did in that0
Thank you so much for detailed explanation @williammccusker, really gave a clarity towards Message forward and Message Client tool, I achieved what I thought0
Happy to hear you got it working!0