Forum Discussion

AnandKiran's avatar
AnandKiran
Frequent Contributor
16 years ago

How to access the functions in Jar file using Groovy

Hi,

I have a small java program which I converted it into Jat file, Now I want to access the functions using groovy in SOAP UI.


public class Calc

{
    int a,b,sum,sub;



      int add()
       
        {     

            sum=a+b;
            System.out.println("Sum ="  + sum);
       


      void sub()
       
        {     

            sub=a-b;
            System.out.println("Sum ="  + sub);
       



}

Can Anyone suggest me how to do it.

Regards
Anand.
  • marcelcasado's avatar
    marcelcasado
    Occasional Contributor
    As documented on the Users's guide :

    If you need to add external libraries to the soapUI classpath for your Groovy scripts (for example jdbc drivers), put these in the bin\ext folder under the soapUI installation, these will be read upon started and added to the soapUI classloader. (not currently possible in the Java WebStart version of soapUI).

    http://www.soapui.org/userguide/functio ... ystep.html


    -Marcel
  • AnandKiran's avatar
    AnandKiran
    Frequent Contributor
    HI marcelcasado ,

    Thanks for the response. I have placed it in Ext folder, but I am not able to access them. I am using SOAP UI 3.0 . Any idea about this issue.

    Regards
    Anand.
  • marcelcasado's avatar
    marcelcasado
    Occasional Contributor
    Hi Anand,

    Are you importing your class on top of you groovy script with the right package name if any ?  If yes , it should work for you. It works for me.

    Check that your jar file was build right and contains your class.

    Regards,

    -Marcel