Forum Discussion

xworker's avatar
xworker
Occasional Contributor
8 years ago

Fails to import WSDL file when running in groovy. Works in SoapUI Ui

Hi

 

I have a WSDL file which I am trying to import and parse from groovy. I works thru the SoapUI GUI but not thru the groovy script. The error I get is:

 

[SoapMessageBuilder] Could not find element [{http://schemas.xxx.com/service/CardServiceRequest/1.0}BlockCardsRequest] specified in part [blockCardsRequestPart]
11:26:18,694 ERROR [WsdlTestRequestStep] Could not find operation [blockCards] in interface [__soap_CardServiceESB_CardServicePT] for test request [null] in TestCase [__soap_CardServiceESB_CardServicePT TestSuite/blockCards]
11:26:18,700 ERROR [SoapUI] An error occurred [Cannot invoke method setName() on null object], see error log for details
java.lang.NullPointerException: Cannot invoke method setName() on null object

The groovy code:

 

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def projectPath = groovyUtils.projectPath //gets the path of the project root	


	def wsdlUrl = testRunner.testCase.testSuite.project.getPropertyValue( "WSDL_url" )
	//wsdlUrl ="/CreditApplicationServicePS.wsdl"
     log.info(wsdlUrl)
	def project = context.testCase.testSuite.project

	
	WsdlProject wsdlProject = new WsdlProject(project.getPath());
	
	WsdlInterface wsdl = WsdlInterfaceFactory
                .importWsdl(wsdlProject, wsdlUrl, true)[0];  
	
	//create and add a test suite to the project
	def suiteName =wsdl.getName()+" TestSuite"
   	WsdlTestSuite testSuite = project.addNewTestSuite(suiteName);
        testSuite.setName(suiteName);

	def i

    for (i = 0; i < wsdl.getOperationCount(); i++) {
        
        //get the operation and its name
        WsdlOperation operation = wsdl.getOperationAt(i);
        def opName = operation.getName();

        //add a testcase and teststeps
        def testStepConfig =   WsdlTestRequestStepFactory.createConfig(operation, opName);
        def testCase = testSuite.addNewTestCase(opName);
        def testStep = testCase.addTestStep(testStepConfig);
        testStep.setName(opName);
        
        def inputHolder = opName + "#Request"
        def holderRawReq = groovyUtils.getXmlHolder(inputHolder)
        
  }

Is there any options to set to make the wsdl importer be less strict?

 

No RepliesBe the first to reply