Forum Discussion
Hi Alex,
Thank you for your response.
I have tried the options which you have suggested however, its not working as expected.
There are no error logs getting generated as well.
Thanks,
Vibhash
Hi Vibhash,
> There are no error logs getting generated as well.
And there is no record in the script log generated by the
log.info 'DEBUG: Inside the script';
line either. Is this correct?
I see this as either some mis-configuration of virtual web service or incorrect call of it.
Try to check the HTTP Log (and Transaction Log on the web service configuration page). The log should contain raw request - maybe you will see something wrong there.
Also, can you try to send the same request that you are sending from Postman but using ReadyAPI means (APIs node of your ReadyAPI project)? I would try this as well. If the call from ReadyAPI passes (at least there will be debug message in the script log) than this will mean that attention should be paid to Postman.
sonya_m : Sonya, could you please draw attention of someone from your team to this thread? Hopefully, your guys will spot some obvious thing that we are missing...
- Vib5 years agoOccasional Contributor
Sure I will update on this thread once I have the solution
- AlexKaras5 years agoChampion Level 3
Hi Vibhash,
If the case is not solved yet, I think it's time to create a Support ticket via the https://support.smartbear.com/message/?prod=ReadyAPI form.
I would appreciate it if you update this thread with the result you will get as I think that our previous actions were correct and we just missed some step.
- Vib5 years agoOccasional Contributor
I was able to move ahead by adding the below event
MockRunListener.beforeRoute and added the below script, the routing is working as expected.
method.setURI(URI.create(method.getURI().toString() + "&enviornment=ENV1"))
Thanks Temil for providing the solution
- Vib5 years agoOccasional Contributor
Hi Alex,
I tried to execute the same request from ReadyAPI and I see the same behavior as I was seeing from POSTMAN.
The additional parameter is not getting appended while routing the request to LIVE system. Even the transcationlog only shows the parameters which I am passing intially. The additional parameter is not getting appended.
Once again thank you for looking into it.
- TSanchez_15 years agoModerator
You can try to set "Route to" value to property expansion and then change it in your script. For example you can set "Route to" is set to ${#MockService#route_endpoint}, and then you can add to your script:
mockRunner.getMockContext().mockService.setPropertyValue("route_endpoint","http://smartbear.com")Let me know if this works. - Vib5 years agoOccasional Contributor
Thank you for your resoponse.
I changed the option to "Route To" and set the value to property expansion as ${#MockService#route_endpoint}.
However, I am getting 404. Even I tried to just put the value as the complete URL, however, I am seeing 404.
And also the script is not getting invoked when I have set the option as "Conditional"
if (! mockRequest.path.contains('/oauth2'))
return false // do not route the request
mockRequest.queryString += '&env=ENV1'
mockRunner.getMockContext().mockService.setPropertyValue("route_endpoint","https:/HOSTNAME/oauth2?mockRequest.queryString")
log.info 'DEBUG: Modified query string - ' + mockRequest.queryString
return true // route the request
Related Content
Recent Discussions
- 18 hours agodipsthorat
- 22 hours agoisbiat
- 2 days agoarmygrad