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.

Groovy script not working in Response Tab

I am trying to validate one of the field from request.
Using Groovy script in the response tab for the validation of the request.

import com.parasoft.api.CorrelationScriptingHookConstants.
def correlateOperation( context) {
requestUrl = context.get(CorrelationScriptingHookConstants.REQUEST.URL)
return requestUrl;
}

With the above code in the response tab, not getting any output displayed when I access the URL. I get the return value when I add something in the dobble quotes.

Once I get the requestUrl value, I can build the validation logic.

Do I need to add any jars files in the path?. Please help me to fix the issue.

Tagged:

Comments

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,
    You should not need to add any jar files. From the sample script you provided is this being used in the responder correlation? You mention in the response tab so I wonder if the script is in the wrong location for doing correlation. Could you attach your sample pva?

  • I am trying to use the above given Groovy script in the RESPONSE tab, not in the responder correlation. The reason I am using in response tab is because I want to validate the request url value and based on that I want to respond with different results.
    Can I do this validation in responder correlation and based on that result can I respond with different responders.

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,
    Yes, the responder correlation is meant to be used to determine if a request "matches" the correlation and if so then the value from the responder tab is sent. If a request does not match the responder correlation the server looks to see if the next responder matches. You could configure your first responder to match when the request URL matches your condition and have a second responder after it without a responder correlation that would response to any requests that failed to match to the first.

    Here a link to the documentation about responder correlations
    https://docs.parasoft.com/display/SOAVIRT9108CTP314/Configuring+Responder+Correlations