Service Virtualization

  • 1.  How to invoke java classes.

    Posted 09-16-2015 04:32 PM

    Hello!

     

    We are trying to figure out how to invoke java classes from within the match script or the response so that we can do some custom xml editing.  Ideally we would like to be able to pull down the whole xml request and pass it to a java class we created.  The main reason for this is to perform some functions related to batch xml requests and responses which we have been unable to do in DevTest on its own.  We have seen some examples of people using {{=ClassName.MethodName()}} to run their java code but we have, thus far, not been able to get that to work.

     

    Thank you very much for any help that you can provide!



  • 2.  Re: How to invoke java classes.

    Posted 09-16-2015 05:15 PM

    This is possible.  You'll need to drop the jar file containing your custom Classes into the LISA_HOME/hotDeploy folder.  Then you would need to reference the fully qualified class name (including package) in your property reference.  You can ensure that your classes are showing up on the classpath by going to View -> Class Path Browser



  • 3.  Re: How to invoke java classes.

    Posted 09-17-2015 11:07 AM

    Could you be a bit more specific about how we go about calling the functions as far as parameters and returns are used?  We have it in our hot deploy already, and as per your suggestion we've checked that it is in the classpath, but we still can't get our classes to work?

     

    Additionally, do you have any suggestions on ways we can guarantee that it is not the java code itself that is going wrong somewhere?

     

    Thanks again for the reply and for your help!  Have a great day.



  • 4.  Re: How to invoke java classes.

    Posted 09-17-2015 12:36 PM

    Are you able to zip up your jar and project and upload it here or send it over?  If so, I can take a quick look for you.

     

    Josh