Forum Discussion

RajaRaja's avatar
RajaRaja
Occasional Contributor
16 years ago

Need to define the SoapUI &Groovy script inbuilt function in to Java coding

Hi All,

I need a help in Define the soapUI & Groovy Script inbuilt function to java program,
Ex:
  Context.setproperty('Value','000'); This Function i want to define to the java program,

Kindly refer the Below pgm:

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
class SoapUIPgm
{
  public static void main(String[] args) throws Exception
  {
        Context.setproperty('Value','000');
            soapUI.log.info("Java - Groovy")

          }
}

i am getting big error message, how to solve this problem,

[align=left:fkb6dp58]Error Message will be
"org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script172.groovy: 26: Apparent variable 'context' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes: You attempted to reference a variable in"
[/align:fkb6dp58]

PFA OF Screenshot also,

Regards
Raja

5 Replies

  • RajaRaja's avatar
    RajaRaja
    Occasional Contributor
    Wht package i need to import?

    Any idea?


    Regards
    Raja
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Not sure what you are trying to achieve - can you tell us the purpose of defining a Java class with a main() inside a Groovy step? How do you intend to execute it?
  • RajaRaja's avatar
    RajaRaja
    Occasional Contributor
    i am try to acheive data driven in soapUI,

    i am reading the Java code for reading the data from excel and pass the data to the request ,Finally get back  the response to excel, this what i am tried to do?
    am i in right path?

    Regards
    Raja
  • RajaRaja's avatar
    RajaRaja
    Occasional Contributor
    I am not using SoapUI Pro, System Datails,

    SoapUI Version: 3.5 Beta
    OS: XP
    Office: 2003
    Java: Jdk1.6

    Kindly let me know any possibility available for achieving my goal, mean data driven in SoapUI (not soapUI Pro)

    Regards
    Raja
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Since you are using the free version, you will have to use a 3rd party library. Try searching this forum for jexcel. That might give you a start.