Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

post JSON to Micorservice using virtual assets

arunvenay
arunvenay Posts: 6

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

Tagged:

Best Answers

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    Answer ✓

    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.

  • williammccusker
    williammccusker Posts: 642 ✭✭✭
    Answer ✓

    Hi,

    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!

Answers

  • jakubiak
    jakubiak Posts: 795 admin

    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.

  • arunvenay
    arunvenay Posts: 6

    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 that

  • arunvenay
    arunvenay Posts: 6

    Thank you so much for detailed explanation @williammccusker, really gave a clarity towards Message forward and Message Client tool, I achieved what I thought

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Happy to hear you got it working!