ramprakash4
7 years agoOccasional Contributor
Could not find matching constructor for: WsdlMockResult(RestMockRequest)
I have a SOAP UI project that is built to provide mock response JSON to a request JSON.
Attached are 2 files
1. Groovy script used in the MockService to interpret the request and construct a ...
- 7 years ago
I implemented the 'Create User' request like this:
import groovy.json.JsonSlurper import groovy.json.JsonOutput import com.eviware.soapui.impl.rest.mock.RestMockResult Map responseObject = [:] switch (mockRequest.path) { case context.getMockService().path + '/admin/user': if (mockRequest.method.toString() == 'POST') { responseObject = createUser() } else if (mockRequest.method.toString() == 'PUT') { // etc } else { // etc } break case context.getMockService().path + '/admin/user/delete': //etc break default: break } mockRequest.httpResponse.setHeader ('Content-Type', 'application/json') mockRequest.httpResponse.getWriter() << JsonOutput.toJson(responseObject) return new RestMockResult(mockRequest) // Responses public Map createUser() { Map requestObject = new JsonSlurper().parseText(mockRequest.requestContent) return [ status: [ code: "DA-200", message: "Success", logMessage: "Success", logMessageAttributes: null ], createUserResult: requestObject.operationDetails ] }