Share and Store CPI Groovy Scripts with Links

Since the online Groovy IDE was very well received by the community, I decided to improve it by enabling sharing and integration. Thank you everyone for comments, giving feedback, and positive vibes!

While I was preparing this post a related productivity improvement feature was added to SAP CPI which enables running parts of flows in simulation. You should definitely check it out!

Use Cases

  • Sharing a message exchange input and Groovy code in a question.
  • Preparing challenges for beginners in a company or preparing tutorials.
  • Sharing very specific solutions for a problem.
  • Send postcards with a Groovy link printed as QR code
  • You can store your favorite templates in browser bookmarks!

How to share

Just click on the share button:

Since I decided not to store anything on the server, a long URL will be copied to the clipboard. It is gzipped which benefits a lot working with XML. You can try it with a reasonably large XML file!

  1. XML file: 460KB (no indentation, one-line input which causes UI problems on most editors)
  2. XML file with indentation: 550KB
  3. Groovy IDE URL for the same input(2): 16KB
  4. My profile picture in this page: 17KB

(I set the server URL limit to 50KB)

Tip: If you are sharing it in a blog post you can hide the long URL like this.

How to integrate

You can trigger Groovy IDE by preparing this URL and opening a new tab:

https://groovyide.com/cpi/share/v1/ + URLSafeBase64(gzip($jsonString))

JSON structure as TypeScript type definition:

interface StateType {
    input: {
        body: string,
        headers: object,
        properties: object
    };
    script: {
        code: string
    };
}

Conclusion

Thanks for your feedback again. If you think about some useful new feature you can write it in the comments or contact me.

Original Article:
https://blogs.sap.com/2020/04/13/share-and-store-cpi-groovy-scripts-with-links/

ASK SAP EXPERTS ONLINE
Related blogs

LEAVE A REPLY

Please enter your comment!
Please enter your name here