views:

97

answers:

1

I am not able to get the Groovy MarkupBuilder to work with soapUI. I am very new to Groovy and I am just following one of the user guides on creating XML.

Testing a very simple method:

public String Example(){
def writer = new StringWriter()
def root = new MarkupBuilder(writer)
root.mkp.xmlDeclaration(version:"1.0", encoding:"UTF-8")
root.Root{
Example("A")
}
return writer.toString()
}

I get the following error in soapUI: ava.lang.NoClassDefFoundError: MockXML$_Example_closure2

I have no error when I run from Groovy Console.

In the same class I have: public String Hello(){ return "Hello" }

Which works fine in soapUI.

Is there something I would need setup/imported/configured in soapUI that I am not thinking about to handle MarkupBuilder/closures?

Thanks

A: 

I believe you have a syntax error in your markup. I think:

root.Root {

should be:

root.Root() {

I think the Groovy evaluating your Root element as a closure instead of a new element in the markup.

Eric Hauser
That causes the same output in the Groovy Console and the same error in soapUI.
Eric
To further complicate things if I put code directly into soapUI instead of using the jar I created it works fine.
Eric