Forum Discussion
For now i am trying with simple payload from the file using this groovy setup. I tried the same file payload by pasting in the xml window of the request and it is working fine.
When test the groovy script alone in am getting the result back from the return variable "returnValue"
what i am not sure is if i am calling the groovy script correctly from the request. i have added the screen shot how i am calling the script from request please let me know if that is correct
Hi,
Firstly, your test should look something like the below where the Groovy Script is before the web service call.
When you want to run this, run the whole test.
Secondly, where to paste in the script command. Below is an example service that passes a JSON body. You can see the JSON payload I want to submit here.
All you have to do is replace the payload with the call to you Groovy script. E.g.
A couple of additional points here. You will have noticed that my example contained a JSON payload and not XML. I've done this sort of things with both. To fix my example to work with XML all I need to change is the Media Type. In the screenshot above, just above the bottom pane, there is a dropdown. You'll need either application/xml or test/xml, though I imagine you've done this correctly if the service does indeed work with XML payload in the request and not in file.
Once you've done that, run the whole test. If the service call doesn't work, the Raw tab can be really helpful. The Raw is only populated once the test request is made. What is shows you is the full and actual request SoapUI sent to your service.
Related Content
- 6 years ago
Recent Discussions
- 15 years ago