Reputation: 2497
I have a mock service that has an operation with two possible responses. How can I select the right response based on a condition using scripting? Eg.
if(context.sessionID == ''){
// use response 1
} else {
// use response 2
}
Upvotes: 1
Views: 5460
Reputation: 328
If your code is in the dispatch script of the "MockResponses" then the correct syntax is:
return "response 1"
[EDIT] This is well-explained in the official web-site: http://www.soapui.org/Service-Mocking/creating-dynamic-mockservices.html#5-selecting-a-response-based-on-the-request
Upvotes: 3