Forum Discussion
13 years ago
Thanks for hint !
Here is generic XML schema validation groovy script for MockService "OnRequest Script":
Here is generic XML schema validation groovy script for MockService "OnRequest Script":
def wsdlcontext = context.mockService.getMockedInterfaces()[0].getDefinitionContext()
def validator = new com.eviware.soapui.impl.wsdl.support.wsdl.WsdlValidator(wsdlcontext);
def operation = mockRequest.soapAction.substring(mockRequest.soapAction.lastIndexOf('/') +1)
log.info context.mockService.toString() + "::" + operation
def wsdlMockOperation = context.mockService.getMockOperationByName(operation)
def msgExchange = new com.eviware.soapui.impl.wsdl.panels.mockoperation.WsdlMockRequestMessageExchange(mockRequest, wsdlMockOperation);
def errors = validator.assertRequest(msgExchange, false);
if (errors.length > 0 ) {
throw new Exception("VALIDATION ERRORS: " + errors.collect(){ '\n' + it })
}
Related Content
Recent Discussions
- 10 days agoemoya