Forum Discussion

Voogd_Support's avatar
Voogd_Support
New Contributor
11 years ago

Request validation against WSDL

Hi,

We're using a large amount of supplied data for use in a dynamic testcase. This testcase submits several teststeps to a webservice, which performs calculations based on the supplied data.

The integrity of the supplied data is arbitrary, so we want to validate the supplied data against the WSDL. To prevent the actual time consuming calculation (including logging/stats etc), we'd want to prevent the calculations by a cancel() in a script assertion (see script below) and proceed to the next datasource row. We've been looking at this from various angles, but without any succes.

Is there any way to get this done?

Thanks!
Patrick Pietersz

[hr:2yg5bjct][/hr:2yg5bjct]

def project = messageExchange.modelItem.testStep.testCase.testSuite.project

def wsdlcontext = project.getInterfaceAt(2).getDefinitionContext()
def validator = new com.eviware.soapui.impl.wsdl.support.wsdl.WsdlValidator(wsdlcontext);

def errors = validator.assertRequest(messageExchange, false)

for ( error in errors ) log.info error

// In any case: cancel the request!

1 Reply

  • Hi,

    It sounds like you would like to validate the data against the wsdl file before submitting any requests? If so, then you should create a Groovy script test step before the request test steps and validate the data, if any of the data is invalid then disable the proceeding test steps and then enable them again after the data is read from the datasource. You can disable them in a groovy script test step by:

    def tesSteps = testrunner.testCase.getTestStepList()
    for (testStep in testSteps)
    {
    if (testStep.getName() != "MyDataSourceLoopName" || testStep.getName() != "MyDataSource" )
    {
    testStep.setDisabled(true)
    }
    }



    You can enable by doing the same thing with just using the for loop and setDisabled(false).


    Regards,
    Marcus
    SmartBear Support