Difference between revisions of "Exercise 08: Integrating a Web Service and a Java API Class"
From AgileApps Support Wiki
Wikieditor (talk | contribs) |
Wikieditor (talk | contribs) |
||
Line 1: | Line 1: | ||
== | ==Introduction== | ||
===Adding Integration Logic=== | |||
:* Developers can access resources to customize an Application<br><br>[[File:Developer_Resources.png|800px]] | |||
===Accessing Web Pages using Web Tabs=== | |||
:* A Web Tab displays a local JSP page, or an (external) page specified by a URL | |||
:* Examples: | |||
:** Company's intranet site from another server | |||
:** Partner website from another server | |||
:** Support website from another server | |||
:** Custom Page created on the tenant | |||
===Adding Web Tabs=== | |||
:* Web Tabs appears in an application only for the Application Roles you specified | |||
:* Optional: Passing parameters to external web page you are invoking | |||
[[File:Web_Tabs.png|800px]] | |||
===Integrating Web Services into your Application=== | |||
:* Web Services get data from an external source | |||
:* You can use Web Services: | |||
:# In External Lookup fields | |||
:# To retrieve “related records” from an External Data Source | |||
:# In process steps of type “Execute Web Service” | |||
:* You can also create a two-step “pipeline service” | |||
:** For example: Handle authorization in the first step and get data in the second step | |||
:* Once you define a Web Service, it is available to every application on your tenant | |||
===Defining a Web Service=== | |||
:* Create a new Developer Resource of kind Web Service | |||
:* Select which type: | |||
:** SOAP: | |||
:*** Upload a WSDL file that describes the remote service (Many operations can be defined in a single WSDL file) | |||
:*** Select the operation you want to call and the version | |||
:** REST: | |||
:*** Provide sample input and output data (XML or JSON) | |||
:*** The platform extracts the parameter names, as if they were declared in a WSDL | |||
:* Specify parameters to ignore and supply hard-coded values | |||
:** Remaining parameters are mapped when the Web Service is invoked | |||
===Using a Web Service in an External Lookup Field=== | |||
:* External Lookup field retrieves one or more records from a Web Service | |||
:* Invoked when an object record is added or updated | |||
:* External Lookup can invoke: | |||
:** A Web Service as lookup service that returns a single record | |||
:** A Web Service as search service that returns multiple records, the user selects from a popup which record to use | |||
:* To configure a lookup service | |||
:** Select configured Web Service | |||
:** Perform Input Mapping: Map values, record fields, user input, or expressions to become Web Service input(s) | |||
:** Perform Output Mapping Map or ignore Web Service output(s) to read-only fields that can be placed at the desired location in the record form | |||
===Using a Web Service to Access an External Data Source=== | |||
:* An External Data Source lets you access a collection of related records from an external data store | |||
:* Records can be displayed in the Related Information section on an object form | |||
:* A Web Service must be configured to supply the records | |||
:* To configure an External Data Source: | |||
:** Select configured Web Service | |||
:** Perform input and output mapping of Web Service parameters | |||
:** Specify record structure of expected related records | |||
===Using a Web Service in Execute Web Service Process Step=== | |||
:* Process Step of type Execute Web Service allows to invoke a configured Web Service in a Process Model | |||
:* Process Model Editor allows to map Web Service inputs and outputs to parameters used in the Process Model | |||
:* A Web Service output can be mapped to a Process Variable | |||
:** Can be used as input to another Web Service, or as criteria for a Decision Switch | |||
:** To create a Process Variable select “Use Variable” in the Output Mapping section of a Web Service step and give it a name | |||
:* Process Variables and Persistence: | |||
:** Process variables do not persist beyond the life of the process | |||
:** Store the value in a record field when: | |||
:*** Persistence is needed (a record is always available for that purpose!) | |||
:*** The value is needed in a Callable Process | |||
:** For a Callable Process, data is also passed in a record field | |||
===Execute Web Service Process=== | |||
:* Execute Web Service | |||
:** Invokes one of the Web Services configured for the application | |||
:** Input Mapping: Map Object fields of the current record, fixed values or expressions to the WS inputs | |||
:** Output Mapping: Map Web Service results or expressions to Object fields of the current record or Process Variables | |||
==Integrating a Web Service (Hands on Lab Part 1)== | |||
===Extend and Integrate with Custom Java Code=== | |||
[[File:Developer_Resources_Class_SubCaseCreator.png|800px]] | |||
===Using Classes in Business Rules=== | |||
:* To invoke a method defined in a custom Java Class from a Business Rule: | |||
:** Select Invoke Method in the Actions to Perform section | |||
[[File:Update_Record_Updated_Event_Rule.png|800px]] | |||
===Writing For details on how to write code for the Java APIs, see the webMethods AgileApps Cloud documentation=== | |||
:* Select the Configuration > Learn More link and do a search for JAVA API | |||
:** Dozens of Java APIs are available for use in a Java class | |||
:** Custom Java Classes and Using the Java API | |||
[[File:Writing_Custom_Java_Classes.png|800px]] | |||
===Macros=== | |||
:* Let you do several things at once | |||
:* Object-related, appear in sidebar in Actions dropdown (like Custom Form Action) | |||
:* Visibility criteria: | |||
:** Determines who sees it the Action list | |||
:** Use field conditions or expressions | |||
:** Tip: When creating expressions, use the field comparisons to find values:* | |||
:* Actions to perform: | |||
:** Set field values, add a note, assign to User/Team, send email, start/stop Process, change Process status, execute Business Rules, execute a Web Service*, invoke Java method* | |||
[[File:Macros.png|800px]] | |||
==Exercise== | |||
This exercise has two parts: | This exercise has two parts: | ||
:* In Part 1, [[Part 1: Integrating a Web Service|you integrate a Web service.]] | :* In Part 1, [[Part 1: Integrating a Web Service|you integrate a Web service.]] |
Revision as of 14:15, 14 December 2022
Introduction
Adding Integration Logic
Accessing Web Pages using Web Tabs
- A Web Tab displays a local JSP page, or an (external) page specified by a URL
- Examples:
- Company's intranet site from another server
- Partner website from another server
- Support website from another server
- Custom Page created on the tenant
Adding Web Tabs
- Web Tabs appears in an application only for the Application Roles you specified
- Optional: Passing parameters to external web page you are invoking
Integrating Web Services into your Application
- Web Services get data from an external source
- You can use Web Services:
- In External Lookup fields
- To retrieve “related records” from an External Data Source
- In process steps of type “Execute Web Service”
- You can also create a two-step “pipeline service”
- For example: Handle authorization in the first step and get data in the second step
- Once you define a Web Service, it is available to every application on your tenant
Defining a Web Service
- Create a new Developer Resource of kind Web Service
- Select which type:
- SOAP:
- Upload a WSDL file that describes the remote service (Many operations can be defined in a single WSDL file)
- Select the operation you want to call and the version
- REST:
- Provide sample input and output data (XML or JSON)
- The platform extracts the parameter names, as if they were declared in a WSDL
- SOAP:
- Specify parameters to ignore and supply hard-coded values
- Remaining parameters are mapped when the Web Service is invoked
Using a Web Service in an External Lookup Field
- External Lookup field retrieves one or more records from a Web Service
- Invoked when an object record is added or updated
- External Lookup can invoke:
- A Web Service as lookup service that returns a single record
- A Web Service as search service that returns multiple records, the user selects from a popup which record to use
- To configure a lookup service
- Select configured Web Service
- Perform Input Mapping: Map values, record fields, user input, or expressions to become Web Service input(s)
- Perform Output Mapping Map or ignore Web Service output(s) to read-only fields that can be placed at the desired location in the record form
Using a Web Service to Access an External Data Source
- An External Data Source lets you access a collection of related records from an external data store
- Records can be displayed in the Related Information section on an object form
- A Web Service must be configured to supply the records
- To configure an External Data Source:
- Select configured Web Service
- Perform input and output mapping of Web Service parameters
- Specify record structure of expected related records
Using a Web Service in Execute Web Service Process Step
- Process Step of type Execute Web Service allows to invoke a configured Web Service in a Process Model
- Process Model Editor allows to map Web Service inputs and outputs to parameters used in the Process Model
- A Web Service output can be mapped to a Process Variable
- Can be used as input to another Web Service, or as criteria for a Decision Switch
- To create a Process Variable select “Use Variable” in the Output Mapping section of a Web Service step and give it a name
- Process Variables and Persistence:
- Process variables do not persist beyond the life of the process
- Store the value in a record field when:
- Persistence is needed (a record is always available for that purpose!)
- The value is needed in a Callable Process
- For a Callable Process, data is also passed in a record field
Execute Web Service Process
- Execute Web Service
- Invokes one of the Web Services configured for the application
- Input Mapping: Map Object fields of the current record, fixed values or expressions to the WS inputs
- Output Mapping: Map Web Service results or expressions to Object fields of the current record or Process Variables
- Execute Web Service
Integrating a Web Service (Hands on Lab Part 1)
Extend and Integrate with Custom Java Code
Using Classes in Business Rules
- To invoke a method defined in a custom Java Class from a Business Rule:
- Select Invoke Method in the Actions to Perform section
- To invoke a method defined in a custom Java Class from a Business Rule:
Writing For details on how to write code for the Java APIs, see the webMethods AgileApps Cloud documentation
- Select the Configuration > Learn More link and do a search for JAVA API
- Dozens of Java APIs are available for use in a Java class
- Custom Java Classes and Using the Java API
- Select the Configuration > Learn More link and do a search for JAVA API
Macros
- Let you do several things at once
- Object-related, appear in sidebar in Actions dropdown (like Custom Form Action)
- Visibility criteria:
- Determines who sees it the Action list
- Use field conditions or expressions
- Tip: When creating expressions, use the field comparisons to find values:*
- Actions to perform:
- Set field values, add a note, assign to User/Team, send email, start/stop Process, change Process status, execute Business Rules, execute a Web Service*, invoke Java method*
Exercise
This exercise has two parts: