Using Business Events in Fusion-based SaaS with Oracle Integration Cloud Service - Part 2: Step-by-Step Example

December 19, 2017 | 6 minute read
Stefan Koser
Consulting Solutions Architect
Text Size 100%:

Following the overview in Part 1, I will now show detailed steps how to create the event subscriptions. In our example, we will use an "Item Creation" event (from SCM cloud).

Prerequisite: Register CSF Key in SaaS

In a FA-based SaaS instance, the outbound call of a webservice uses a OWSM security policy which retrieves the credentials for the call from a CSF Key. This means that you need to register a CSF key for every connection to an external system. In our case we need to register a CSF key for the ICS/OIC instance:

  • The name of the CSF key must match the ICS instance name or OIC account name

  • The user must be an ICS/OIC user

  • The password must be the password of this ICS/OIC user

You create this CSF key via SOA composer - accessible through the URL   <base_fa_url>/soa/composer

Create CSF key

Enter the details and press "Register".

This is the only step required for a R13 GSI cloud instance. If you still have a R12 instance, then additional steps may be required.

Create a Connection from ICS/OIC to SaaS

For subscribing to the "Item Creation" event in SCM Cloud, we need to first create a new connection using Oracle ERP Cloud Adapter to Oracle SCM Cloud.

You need to specific two URLs for the connectivity:

  • Service Catalog WSDL URL: this is the SOAP endpoint to retrieve all published  SOAP web services

  • Event Catalog URL: this is a REST endpoint which exposes all available events. The adapter uses this to display a list of events which you can select from

Typically these 2 URL look like this for a Fusion Cloud instance XYZ  with base URL https://XYZ.em2.oraclecloud.com/ (the subdomain EM2 stands for data center Amsterdam):

  • Service Catalog WSDL URL: https://XYZ.em2.oraclecloud.com/fndAppCoreServices/ServiceCatalogService?wsdl

  • Event Catalog URL: https://XYZ.em2.oraclecloud.com/soa-infra

The following picture shows how to create the connection in ICS:

CreateConnection

If testing the connection works fine, then you can skip the next step and directly proceed with creation an integration.

Test the Service Catalog and Event Catalog URLs

You can verify if you have the correct URLs by entering them in the following way into a web browser:

  • Service Catalog WSDL URL: Enter the complete URL like https://XYZ.em2.oraclecloud.com/fndAppCoreServices/ServiceCatalogService?wsdl After providing correct credentials for a FA Cloud user, a wsdl file should be displayed

  • Event Catalog URL: Enter the URL followed by "/PublicEvent/catalog" - example https://XYZ.em2.oraclecloud.com/soa-infra/PublicEvent/catalog After entering credentials, this should present a JSON response with all events.

This is the example of our Item Creation Event (you don't need to know this details level - this is just to inform what happens under the covers):

{
"documentService": {
"wsdlInterface": "http://xmlns.oracle.com/apps/scm/productModel/items/itemServiceV2/#wsdl.interface(ItemService)",
"inputXSLT": "oramds:/oracle/apps/scm/productModel/items/findItemFromItemBE.xsl",
"keyMaps": [],
"csfkey": null,
"outputXPath": null,
"wsdlPort": "http://xmlns.oracle.com/apps/scm/productModel/items/itemServiceV2/#wsdl.endpoint(ItemService/ItemServiceSoapHttpPort)",
"wsdlLocation": "${ORA_FSCM_SERVICESAPPProtocolToken}://${ORA_FSCM_SERVICESAPPHostToken}:${ORA_FSCM_SERVICESAPPPortToken}/fscmService/ItemServiceV2?WSDL",
"operation": "findItem"
},
"documentTransform": null,
"customEvents": [],
"name": "{/oracle/apps/scm/productModel/items/protectedModel/entity/events/edl/ItemEO}postItemCreate",
"id": "SCM_EGP_ITEM_CREATE",
"displayName": "Item Create Event",
"description": "This public event signals an item is created"
}

Create an Integration which is triggered by an Event

A business event is a one-way invocation by the SaaS instance of an endpoint provided internally by the Cloud Adapter. One use case would be to start an orchestration in ICS/OIC - another would be to publish the event message internally to ICS and subscribe to that from another integration.

In case of an orchestration, you can either drop the adapter inside an orchestration - or use a "Map Data" flow to call the orchestration:

Create-MapData

Use the recently created ERP Cloud Adapter connection and drop it as a trigger:

ERPCloud-Adapter-Step1

In the next wizard step, select "With Business Events" as request type, and browse in the list to "Item Create Event" and select that. In case you see no option "With Business Events", then the Event Catalog URL has not been defined in the Connection settings.

ERPCloud-Adapter-Step2

Leave the Filter Expression empty (will show how to use that in the next part). In the next step, select "None" for Response Type, "Next" and finish the wizard with "Done"

The result will look like this:

ERPCloud-Adapter-Step3 After Connection creation

The filter icon on the arrow provides an alterative way to filter events on ICS/OIC side - if the adapter does not provide this option. The drawback is that all events get published over the network to ICS/OIC - and only some pass the filter - which can cause performance issues for high volumes. In our case it is much more efficient use the filter capabilities of the adapter - which we will shot in part 3.

The "plus" icon offers a way to enrich the message - which will not discuss here.

The next steps are

  • Drop a target service into the right side of the flow. This needs to expose a one-way SOAP operation. In my example, I created a simple orchestration with one string as input.

  • Map an element of the event payload to the parameter of your service. In my example I mapped the Item Number to the input string.

  • Select one of the event payload elements as Tracking parameters. In my example I selected the same element Item Number.

When editing the map, you will see a choice of elements in the Item payload on the event. This payload format is identical to the response of the findItem web service:

ICS Mapping Item Event Result

The resulting integration looks like this:

ERPCloud-Adapter-Step4 After Finishing the Integration

Save and close the Design view and Activate this integration:

ERPCloud-Adapter-Step5 After Activating

Test the Events

Now you can try and create a new item in Oracle ERP Cloud: Login as SCM user, go to Product Development, select "Create Item" and enter the basic information - in my example I created a new item of Item Class "Smartphones":

SCM Create Item IPhoneX

Click "Save and Close". Now examine in ICS that the item creation event has correctly triggered the integration:

ICS_AfterCreateIPhoneX_Item

Click on the "1" above "Success":

ICS_AfterCreateIPhoneX_Monitoring

If you click on this instance, you can see a trace of the execution:

ICS_AfterCreateIPhoneX_AuditTrail

Verification in Case of Issues

You can verify if the event subscription has been correctly registered in the FA Cloud instance by executing the followoing URL in a browser:

https://<fa-base-url>/soa-infra/PublicEvent/subscriptions

where <fa-base-url> is something like  xxx.oraclecloud.com. This URL is secured by credentials of the Fusion Cloud instance.

You should get a list of subscriptions in JSON format - including the one created for Item Creation event:

{"subscriptions":[{"csfKey":"a112325",
"endpointURL":"https://xxxx-a112325.integration.em2.oraclecloud.com:443/integration/flowsvc/erp/SUBSCRIBE_ITEM_CREATION/v01/",
"filter":null,
"name":"{/oracle/apps/scm/productModel/items/protectedModel/entity/events/edl/ItemEO}postItemCreate",
"id":"123=",
"state":true}]}

 

This was our last step of the Item Creation example.

Part 3 will focus on how to filter only some events for triggering an integration.

Stefan Koser

Consulting Solutions Architect


Previous Post

Using Business Events in Fusion-based SaaS with Oracle Integration Cloud Service - Part 1: Overview

Stefan Koser | 3 min read

Next Post


Using Business Events in Fusion-based SaaS with Oracle Integration Cloud Service - Part 3: Event Filter Expressions

Stefan Koser | 4 min read