ContributionsMost RecentMost LikesSolutionsFails 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? Go thru and insert values in each node for a requestHi I want to go thru a request with groovy and insert a parameter for each node in the request the has a value. The substring part is to get rid of the namespace part, not so pretty, maybe there is a better way? This is my script so far. Works but do not update the request in soapui: import com.eviware.soapui.support.GroovyUtils; import com.eviware.soapui.support.XmlHolder import groovy.util.XmlParser; def testStep = testRunner.testCase.getTestStepAt(1) def testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); def groovyUtils = new com.eviware.soapui.support.GroovyUtils( testStepContext ) def requestHolder = testStep.testRequest.getRequestContent() def holder = groovyUtils.getXmlHolder(requestHolder) def rootNode = new XmlParser().parseText(holder.getXml()) rootNode.depthFirst().each { def name if(it.text()!="") { name= it.name().toString() name=name.substring(name.indexOf("}")+1, name.length()) holder["//tec:"+name]="\${#TestCase#" +name+"}" holder.updateProperty() } } testStepContext.requestContent = holder.xml ThxInject context into groovy classHi I am trying to structure my groovy a bit more with classes. However now I get an error saying groovy.lang.MissingPropertyException: No such property: context for class: GameWSTool My class is this: class GameWSTool{ def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def project = context.testCase.testSuite.project def testSuite = project.testSuites['StartingPoint']; def testCase = testSuite.getTestCaseAt(1) //GenerateInputData def noItems = 10 def i =0 def sb = new SwingBuilder() static void main(String[] args){ def tool = new GameWSTool() tool.show() } Do I need to inject the context somehow? ThanksRe: how to access requests in other testCases/testSuitesOk, solved it. You have to create a context for the testStep where you currently are, like this: import com.eviware.soapui.impl.wsdl.teststeps.* def project = context.testCase.testSuite.project def testSuite = project.getTestSuiteAt(5) def testCase = testSuite.getTestCaseAt(1) def testStep = testCase.getTestStepAt(1) // this will get the current teststep name def teststepname = testStep.getName().toString() //create a context for the teststep where we are def testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); //create a util on the testStepContext def groovyUtils = new com.eviware.soapui.support.GroovyUtils( testStepContext ) def inputHolder = teststepname + "#Request" def holderRawReq = groovyUtils.getXmlHolder(inputHolder) holderRawReq["//tem:brandId"] = "test7" holderRawReq.updateProperty()how to access requests in other testCases/testSuitesHi This is my code, for testing I am getting the 5th testsuite, the first testcase and the first teststep. It is the getXmlHolder line the fails with "Unexpected CDATA" error. I have tried to add the testSuite and testCase to the inputHolder string but that doesn't help either. This script works as long as the script is in the same TestCase as the request it is trying to access. How to do this for other TestCases and other TestSuites? def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def project = context.testCase.testSuite.project def testSuite = project.getTestSuiteAt(5) def testCase = testSuite.getTestCaseAt(0) def testStep = testCase.getTestStepAt(0) def teststepname = testCase.getTestStepAt(0).getName().toString() def inputHolder = +teststepname + "#Request" log.info(inputHolder); def holderRawReq = groovyUtils.getXmlHolder(inputHolder) holderRawReq["//tem:brandId"] = "test" ThxCache WSDLI cannot make SoapUi stop loading wsdl definitions when executing testsuites. Even thou I have checked the "cache wsdl" checkbox in preferences. This wsdl loading is making it imposible to run loadtest.Memory issues for wsdlHi Getting alot of memory issues in Soapui pro 4.5.1. Suites work fine but after a while soapui slows down and become unresponsive. Seems to be related to loading wsdl definitions? The wsdl files are generated by Rational Software Architect and should not contain any errors. I belive that the soap version is 1.1 Logs look like this: 2012-08-17 10:46:47,944 ERROR [errorlog] com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:138) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:535) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:524) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:97) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:236) at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46) at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149) at java.lang.Thread.run(Unknown Source) 2012-08-17 10:46:49,969 ERROR [errorlog] com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:138) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:535) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:524) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:97) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:236) at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46) at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149) at java.lang.Thread.run(Unknown Source) 2012-08-17 10:46:51,008 ERROR [errorlog] com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:138) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:535) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:524) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:97) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:236) at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46) at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149) at java.lang.Thread.run(Unknown Source) 2012-08-17 10:46:51,112 ERROR [errorlog] com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:138) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:535) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:524) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:97) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:236) at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46) at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149) at java.lang.Thread.run(Unknown Source) 2012-08-17 12:46:00,147 ERROR [errorlog] java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space at org.apache.xmlbeans.impl.store.CharUtil.allocate(CharUtil.java:397) at org.apache.xmlbeans.impl.store.CharUtil.saveChars(CharUtil.java:506) at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.text(Cur.java:2925) at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.attr(Cur.java:3046) at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.attr(Cur.java:3063) at org.apache.xmlbeans.impl.store.Locale$SaxHandler.startElement(Locale.java:3259) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportStartTag(Piccolo.java:1082) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseAttributesNS(PiccoloLexer.java:1802) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseOpenTagNS(PiccoloLexer.java:1521) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1362) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXMLNS(PiccoloLexer.java:1293) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXML(PiccoloLexer.java:1261) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4808) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714) at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454) at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:712) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:696) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:683) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208) at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:633) at com.eviware.soapui.support.xml.XmlUtils.createXmlObject(XmlUtils.java:217) at com.eviware.soapui.impl.support.definition.support.InterfaceCacheDefinitionLoader.getPartContent(InterfaceCacheDefinitionLoader.java:104) at com.eviware.soapui.impl.support.definition.support.InterfaceCacheDefinitionLoader.loadXmlObject(InterfaceCacheDefinitionLoader.java:64) at com.eviware.soapui.impl.support.definition.support.InterfaceCacheDefinitionLoader.load(InterfaceCacheDefinitionLoader.java:47) at com.eviware.soapui.impl.wsdl.support.wsdl.AbstractWsdlDefinitionLoader.getBaseInputSource(AbstractWsdlDefinitionLoader.java:87) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlInterfaceDefinition.load(WsdlInterfaceDefinition.java:52) at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:66) at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlContext.loadDefinition(WsdlContext.java:30) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext.cacheDefinition(AbstractDefinitionContext.java:278) 2012-08-17 12:46:01,812 ERROR [errorlog] java.lang.Exception: java.lang.OutOfMemoryError: Java heap spaceRe: soapui with REST and PathParmFound the solution. in a TestCase define a property then use is with the ${#propertyname} in the testcase. The request will look something like this: http://localhost:8080/projectName/restService/${#propertyname} /xsoapui with REST and PathParmHi How do I test my REST service which uses PathParams in soapui? My service url is like this: http://localhost:7001/myProject/users/1 The PathParam in the url above is 1, how do I get this a parameter to my request. Thanks x