Monday, April 10, 2023

Convert String to List based on a delimiter in OIC

Many of my colleagues have reached out to me for a solution to a scenario where the Downstream app expects List of values as Response and Upstream app is sending data as comma separated value.

For example, Upstream Data format - 


And Downstream is expecting as-


Solution for this is simple. Use Xpath function oraext:create-nodeset-from-delimited-string

The function takes a delimited string and returns a nodeSet and has the following signature:
oraext:create-nodeset-from-delimited-string(qname, delimited-string, delimiter)
where –
qname – is name of node which will hold Nodeset values. Example (“ns0:listValue”)
delimited-string – String containing delimited values. Example (“aaa,bbb,ccc”)
delimiter – delimiter value. Example (“,”)


Let’s implement this in a sample App Driven Orchestration OIC Service –

1. Create App Driven Orchestration service and configure Rest Endpoint with Request and Response Payload as mentioned above

2. Map CityList -> City and now we will move to Source code of Map and make changes

3. Add a variable “varCityList” which will hold nodes from Create Nodeset function

<xsl:variable name="varCityList" select="oraext:create-nodeset-from-delimited-string('city',/nstrgmpr:execute/nstrgdfl:request-wrapper/nstrgdfl:CityList, ',' )"/>

4. Add for each element inside varCityList above City as we want City to repeat for every element and then in City select value of current element

Finally, your map would look like this -

<xsl:template match="/" xml:id="id_11">
<nstrgmpr:executeResponse xml:id="id_12">
<nstrgdfl:response-wrapper>
<xsl:variable name="varCityList">
<xsl:copy-of select="oraext:create-nodeset-from-delimited-string('city',/nstrgmpr:execute/nstrgdfl:request-wrapper/nstrgdfl:CityList, ',' )"/>
</xsl:variable>
<xsl:for-each select="$varCityList/*">
<nstrgdfl:City>
<xsl:value-of select="."/>
</nstrgdfl:City>
</xsl:for-each>
</nstrgdfl:response-wrapper>
</nstrgmpr:executeResponse>
</xsl:template>

Now, you can Save, Activate and test the integration. 

Thank you.

Thursday, April 21, 2022

Sending OIC Instance ID Tracking page link in Error emails

In case of any Fault in Integrations, one of the most common configured step is to send email along with some important details such as Instance ID and other fault details.

After reading email, we often want more information about error and for that we must look at the flow trace to understand what caused this fault. For this usually the step is to login to OIC console then go to Monitoring -> Tracking and then filter based on Instance ID which usually consumes quite amount of time. However, we can totally save this time by embedding a hyperlink of Instance ID Tracking page in the email itself at design time.

Steps to achieve–
  1. In Notification Template create a reusable HTML body which contains Instance Id and before that add <a href='{InstanceBaseUrl}{InstanceId}'>
    If you are sending instance details in table row, then it would look something like this
    <tr>
    <td width="200" valign="top"><b>Instance ID</b></td>
    <td valign="top"><a href='{InstanceBaseUrl}{InstanceId}'>{InstanceId}</a></td>
    </tr>
  2. Set Parameter name and its value as
    InstanceBaseUrl – concat($self/nsmpr0:metadata/nsmpr0:environment/nsmpr0:baseURL,'/integration/home/faces/link?page=tracking&tracking_id=')
    InstanceId - $self/nsmpr0:metadata/nsmpr0:runtime/nsmpr0:instanceId
  3. Activate and test. Your email should look like below screenshot and once you click on Hyperlink it will open that Instance ID.
Bonus tip –

For Integrations developed using Oracle SOA Suite - BPEL you can send Flow ID links in emails. To generate generic Flow ID url and use it-
  1. Navigate to SOA Infra -> Flow Instances and click on Search Options.
  2. Change Instance created Time to 7 days
  3. Click on Add/Remove Filter and remove all selection and check Flow Instance
  4. Click on generate Bookmarkable Link and copy the URL. It would look like this -
    http://{hostname}:{port}/em/faces/ai/soa/infra?flowQuery=fId%3A{flow_id}%3Bct_twv%3A7%3Bct_twu%3Adays%3Bct_md%3Anormal%3B&type=oracle_soainfra&selectedTab=flowInstancesTab&target=/Domain_DefaultDomain/DefaultDomain/DefaultServer/soa-infra
  5. There are some values which are env specific so, create two BPEL properties to store URL values, everything before flow_id as part1 and everything after that as part2. Now concat these in assign and add this as href in email which triggers from SOA, similarly to how we did in OIC. We can update config plans to with env specific properties values and then migrate.
Let’s look at the result