Skip to Content

Developing HCI Groovy scripts in Eclipse - missing Message class dependency?

I am using Eclipse (Mars) and the latest version of the SAP Cloud Platform Integration Tools Plug-in.

When creating a new script in the integration flow and new .groovy file automatically created. By default it opens in a basic (not very helpful) editor.

I have added the Groovy plug in to get content assistance. I have also updated the build path so that the necessary libraries are added for Java and Groovy. However, I still get errors in the editor because of a missing dependency that all the scripts generated by the Integration Designer will have.

The scripts all import

com.sap.gateway.ip.core.customdev.util.Message

which is not on the build path. Where can one download a JARwhich contains this class so that we can use the editor without errors and with content assistance?

I recall similar issues years ago when developing UDFs for SAP PI - back then the solution was to find the necessary JAR on the PI server, but I can't do something similar with a Tenant in the Cloud.

Any advise would be appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 09, 2017 at 06:04 PM

    Hi Malcolm

    It's an interesting question. Like Sriprasad, I don't believe a JAR is available. You could, however, create one yourself and add it to the build path. Your code would look something like the following:

    package com.sap.gateway.ip.core.customdev.util;
    
    class Message {
    
       public void setBody(Object newBody) {
          // No actual code needed here, the method signature is the interesting bit
       }
       
       // Other methods go here
    
    }
    

    Compile your class, add it to a JAR and add that JAR to your project's build path. That will take care of the dependency issue.

    If you really want to go all in, post the code on Github and write a blog about it here ;-)

    Regards,

    Morten

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 09, 2017 at 05:18 PM

    Hello Malcolm,

    Even I have also tried to find out the jars(similar to SAP PI)which you are asking here but unfortunately no luck.

    In alternative way this is what I am following.

    Have your input XML and save it as string using below syntax

    Def str_input='''<root><test>val1</test></root>'''

    Write your logic for the above input for testing use printing when you want to use it in hci set it using setbody().

    To test there are 2 ways

    1)Groovy web console-you will not be able to add external jars , sometimes I felt it's not that worth using it.

    2)download the groovy console from groovy official site(best way to write the groovy where you can import all the required jar files).

    3)Even you can use eclipse also with Groovy plugin but I felt it's very easy to follow second method.

    To know more about the methods available to use within processedata() method are documented in Java API section of sap hci help which you can use it with core transformation logic written using above 2 methods.

    Hope it helps!

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 13, 2017 at 05:00 AM

    Hello,

    Script API JAR has been made available now and it can be downloaded from https://tools.hana.ondemand.com/#cloudintegration

    --

    Thanks and Regards,

    Bhuvan Mehta

    Add comment
    10|10000 characters needed characters exceeded