Forum Discussion

sankar1v's avatar
sankar1v
New Contributor
14 years ago

Help Me - Java RMI Call using groovy script in soapUI 3.6.1

Hi Eviware Team,

I am trying to call RMI method using Groovy in soapUI 3.6.1. Standalone groovy code is working fine, but groovy in codesoapUI is not working.

Do I need to make any changes. Is there any way to access RMI other than Groovy coding in soapUI.

1. I have created java code with RMI server functionality & also created client program(both server and client are in the same computer).
2. Started Server program
3. Ran Client program, it is working fine.
4. Created groovy client script and ran, it is also working fine.
5. Copy & pasted groovy script to soapUI groovy and ran the code, but it is failing with the below error. Here ServerImplements is my class name which implements interface. It seems that the code is not able to get the path of Stub class. For this I have tried adding the classpath to groovy code using ClasspathHacker.

Mon Apr 18 10:20:35 EEST 2011:INFO:java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: ServerImplements_Stub

Groovy Code:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def classpathHacker = new com.eviware.soapui.support.ClasspathHacker ()
path = "C:/San/RMI/RMI EX 2"
myfile = new java.io.File(path + "/ServerImplements_Stub.class")
mystring = "file://" + path + "/ServerImplements_Stub.class"
classpathHacker.addFile( myfile )
com.eviware.soapui.support.ClasspathHacker.addFile( myfile )
com.eviware.soapui.support.ClasspathHacker.addURL( new URL(mystring) )
import groovy.ServerImplements.*
try
{
def s=Naming.lookup("rmi://"+host+"/RMIAPPLICATION")
log.info(s.add(10,20))
}
catch (ConnectException connectEx)
{
log.info( connectEx)
}
catch (RemoteException remoteEx)
{
log.info( remoteEx)
}

Please help me why the same groovy code is not working from soapUI. Any path changes required.

Br,
Sankar
No RepliesBe the first to reply