GELS2020 - Gel Scripts - Advanced

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

GEL

Scripts|
Advanced

Your Guides: Ben Rimmasch, Yogesh Renapure


Introductions
2

• Take 5 Minutes

• Turn to a Person Near You

• Introduce Yourself

Let Rego be your guide.


Agenda
3

• Accessing JAVA Classes and Methods


• SOAP Web Services (XOG)
• REST Web Services
• File Handling
• Integrations

Let Rego be your guide.


Accessing JAVA Classes and Methods
4

• Instantiate Java Classes and Call Java Methods


• core:new
• Use this GEL tag to instantiate Java classes
• For Ex:

• core:invoke
• Use this GEL tag to call a method on an instantiated object
• For Ex:

Let Rego be your guide.


Accessing JAVA Classes and Methods Cont’d
5

• core:expr
• Use this GEL tag to call a method on an instantiated Java object where you do not require access
to the result of the operation.
• In the REST calls, this tag can be used to set request headers
• For Ex:

• core:invokeStatic
• Use this GEL tag to call a static method of a Java class
• For Ex:

Let Rego be your guide.


SOAP Web Services (XOG): Namespaces
6

• Think of XML namespaces as a way to organize tag names (and attribute


names) into groups
• The namespaces below are required to call CA PPM SOAP Web Services
(XOG)

Let Rego be your guide.


SOAP Web Services (XOG): Obtain Session ID
7

• The following snippet is used to generate a Session ID. This approach


cannot be used for cross-environment SOAP calls

Let Rego be your guide.


SOAP Web Services (XOG): Build XML
8

• Use the <gel:parse> tag to build a XOG XML


• For Ex:

Let Rego be your guide.


9

SOAP Web Services (XOG): Read, Write, Delete Nodes

• Read Node
• Use the below snippet to read the description of a group from userXML

• Write Node
• Use the below snippet to create a new group node in the userXML

Let Rego be your guide.


10

SOAP Web Services (XOG): Read, Write, Delete Nodes

• Delete Node
• Use the below snippet to delete a group node from userXML

Let Rego be your guide.


SOAP Web Services (XOG): Execute XOG
11

• Use the below snippet to execute a XOG SOAP web service call

Let Rego be your guide.


SOAP Web Services (XOG): Execute XOG Cont’d
12

• Obtaining XOG endpoint


• endpoint = “Internal”
• Quick way to setup SOAP call to the same instance

• From properties.xml using JAVA Classes

Let Rego be your guide.


13

SOAP Web Services (XOG): Execute XOG Cont’d

• From properties.xml using GEL tags


• If the entryUrl doesn’t work, the sslEntryUrl or schedulerUrl can be pulled

Let Rego be your guide.


SOAP Web Services (XOG): Parse Output
14

• To ensure success and as part of error handling the following snippet demonstrates how
to parse through the XML response returned by the SOAP call to the XOG interface

Let Rego be your guide.


SOAP Web Services (XOG) : XOG Logout
15

• Use below snippet to end the XOG session

Let Rego be your guide.


REST Web Services
16

• A RESTful API is an application program interface (API) that uses HTTP


requests to GET, PUT, POST and DELETE data.
• REST technology is generally preferred to the more robust SOAP technology
because REST leverages less bandwidth, making it more suitable for
internet usage.
• Results typically JSON (JavaScript Object Notation) response format
• Currently CA PPM REST APIs are not supported for customer or partner use
• The steps described here can be used to call REST APIs of any application
from CA PPM

Let Rego be your guide.


REST Web Services – Authentication
17

• Below are the most commonly used authentication methods for REST web
services
• Basic Authentication
• Authenticate using Base64 encoded string of Username and Password

• Token Based Authentication


• Token from Login and Logout API
• OAuth 2.0 tokens
• Application generated tokens

Let Rego be your guide.


REST Web Services – REST Call
18

• Maintain Session
• CA PPM REST API requires to maintain the session. Use the below snippet to
maintain the CA PPM REST session

Let Rego be your guide.


REST Web Services – REST Call Cont’d
19

• Below are the steps to Call CA PPM REST API


• Form Input JSON

• Open Connection to CA PPM REST URI

Let Rego be your guide.


REST Web Services – REST Call Cont’d
20

• Set Request Headers

• Write Input JSON to REST API

Let Rego be your guide.


REST Web Services – REST Call Cont’d
21

• Process REST Output

Let Rego be your guide.


File Handling: Overview
22

• The CA provided GEL tag libraries can


• Read files and write to a file
• Perform a set of FTP operations
• Parse nodes and attributes of XML or comma-delimited files with some limitations
• The CA provided GEL tag libraries cannot
• Create a directory to put files in
• Move files around
• Delete files after it is done with them
• Java can almost always fill in the gaps

Let Rego be your guide.


File Handling: Read File
23

• Below is the example script to read a pipe delimited file

• ‘embedded’ attribute determines if data is surrounded by quotes or not. Default


value is false.

Let Rego be your guide.


File Handling: Write File
24

• Writing files is a way to export data, perhaps to be used in an integration by


another application

• Use serialize tag to write XML content to an XML file

Let Rego be your guide.


File Handling: FTP
25

• By including the namespace for the FTPTagLibrary, GEL has the ability to
read and write files on an FTP Server
• This library does not support SFTP, FTPS or passive mode
• Namespace
• <gel:script xmlns:gel="jelly:com.niku.union.gel.FTPTagLibrary">
• Tags
• ftp:open
• ftp:put
• ftp:get

Let Rego be your guide.


File Operations: FTP Cont’d
26

• Below is the snippet to read a file from FTP location

• Below is the snippet to write a file to FTP location

Let Rego be your guide.


Integrations: Overview
27

• Integration Triggers
• Manual (User initiated)
• Scheduled
• Event Based

• Integration Methods
• Flat Files
• Web Services
• Database Links
• Third Party Tools

Let Rego be your guide.


Integrations: Methods
28

• Flat File Based Integration


• Based on extract from source system
• Not a real time integration but a scheduled job
• Needs coordination between both application teams
• Complexity of the development is medium
• Web Service Based Integration
• Applications should be able to access web services
• Can provide near real time integration
• Both application teams needs involvement in case of bi-directional integration
• Complexity of the development is high

Let Rego be your guide.


Integrations: Methods Cont’d
29

• Database Links Based Integrations


• Applications should provide direct database connections
• High risk, high performance
• Less complex to develop
• Third Party Tools
• Integration can be a real time or a scheduled job
• More dependency on the third party tools
• Less complex to implement
• Can be difficult to troubleshoot issues

Let Rego be your guide.


Integrations: Details
30

• Staging areas should often be utilized to load and validate the data prior to
pushing the data into the final destination inside CA PPM
• This helps reduce errors during the data load and can allow user interaction to
correct the values prior to processing
• A combination of GEL tag libraries, Java, and SQL can be utilized in
integration code
• A GEL script inside a process
• A SQL stored procedure inside a job definition
• A Java executable inside a job definition
• Note that stored procedures and Java executables are unsupported in on-demand
environments for security and stability reasons

Let Rego be your guide.


Integrations: Details Cont’d
31

• A typical flat file approach for exporting data from a GEL script:
• A query is ran to gather data to be sent to the other application
• The data is formatted into a file using the writeFile tag
• The file is uploaded to a FTP server using the FTPTagLibrary open and put tags
• The process containing the GEL script is scheduled to run at an agreed time
• The same process, instead of being scheduled, can be invoked by the
external application.

Let Rego be your guide.


Questions?

Let Rego be your guide.


Thank You For Attending regoUniversity
33

Instructions for PMI credits


• Access your account at pmi.org
Let us know how we can improve!
• Click on Certification Don’t forget to fill out the class survey.
• Click on Maintain My Certification
• Scroll down to Report PDU’s
• Click on Course Training (or other appropriate category)
Phone
• Enter Rego Consulting
888.813.0444
• Enter Activity- Enter Name of Course
• Enter Description
• Enter Date Started Email
• Enter Date Completed [email protected]
• Provide Contact Person Name of Person to Contact
• Provide Contact E-Mail E-Mail of Person to Contact
• Enter Number of PDU’s Claimed (1 PDU per course hour) Website
• Click on the I agree this claim is accurate box www.regouniversity.com
• Click Submit button

Let Rego be your guide.

You might also like