header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
November 22, 2008, 06:30:53 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
Using user-defined java (or groovy) class in script
Welcome, Guest. Please login or register.
November 22, 2008, 06:30:53 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  Using user-defined java (or groovy) class in script
« previous next »
Pages: [1] Print
Author Topic: Using user-defined java (or groovy) class in script  (Read 495 times)
PeterT
Newbie
*
Posts: 12


« on: March 06, 2008, 04:32:49 am »

Hi there

So, I'm finally getting a bit of a handle on SoapUI and Groovy.  One thing (at the moment) that I'm having trouble with is using a user-defined java class in my Groovy Script. 

I've made a very basic class, Test.java, which just returns a string. I've compiled it and put both the .java and .class file in the \soapUI-2.0.2\bin\ext folder and imported the package in my script.  When I try to run the script however it cannot resolve the new object that I created (e.g. def t = new Test()).   

I know that this should be doable and I'm sure I just haven't put the .class file in the right location or something like that.

Can anyone shed any light on this?

Cheers

Peter
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #1 on: March 06, 2008, 07:04:10 am »

Hi Peter,

you need to package your class file in a jar archive and then put that .jar file in the bin\ext folder.

Hope this helps!

regards,

/Ole
eviware.com
Logged
PeterT
Newbie
*
Posts: 12


« Reply #2 on: March 06, 2008, 08:12:47 pm »

Hi Ole

Actually I did that and while I could see in the command window that it was picking up the .jar file it still didn't recognise the object I was trying to create. Perhaps I screwed up creating my .jar, will give it another go.

Thanks for your help again.

Cheers

Peter
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,425


« Reply #3 on: March 07, 2008, 12:08:16 am »

Ok, hope it works better this time, let me know if we can help some more!

regards!

/Ole
eviware.com
Logged
Pesotska
Newbie
*
Posts: 2


« Reply #4 on: March 14, 2008, 02:17:18 pm »

Hi,

I have also the problem  with user-defined java class in Groovy script

I've made a very basic class Test.java, which returns a string.
I have packaged Test.class in a jar archive and then put test.jar file in the soapUI-2.0.2\bin\ext folder.

Groovy script:

import soapuitest.*

def test = new soapuitest.Test()


By script Running:

org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed, Script14.groovy: 3: unable to resolve class mysoapuitest.GenerateExternalBookingId @ line 3, column 14.
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class mysoapuitest.GenerateExternalBookingId @ line 3,
column 14. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:113)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:132)
....

Could someone help me?

Best regards,
Liliya
Logged
Pesotska
Newbie
*
Posts: 2


« Reply #5 on: March 14, 2008, 04:00:39 pm »

Sorry!
 Smiley
It functions nevertheless, error lay in the JAR!

Best regards,
Liliya
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header