Friday, November 8, 2024

#1035 - OIC Integration Basics - Lab 7 Integration Actions

Introduction

Actions are the building blocks for your integrations. This post will explain each of them, and also provide examples of using such.

Assign

Assign is used to create and assign values to variables.

Just overwrite the highlight with your variable, in my case, I a variable to hold the count of order lines in the request payload.

I the add a Logger action, one we've already met, to output the value of the variable -

Note how the variable is available for usage, not only here, but also in the mapper.

I run the integration - 

B2B

The B2B action can be thought of as a pre- or post-processor of a canonical integration. So what do I mean by this? Say I have a generic integration to process orders. However, these orders can be sent in edifact format, by my B2B trading partners. The pre-processing steps are to check if the order is a valid edifact document and is coming from a bona fide trading partner. Post-processing steps could involve transforming an order from its canonical <xml> format to its edifact equivalent. 

Remember, the lingua franca of OIC is <xml>. So all incoming messages, e.g. json based, are transformed into <xml> for processing, the result can be transformed back to json, if required. The OIC engine takes care of json to xml etc. But we need the B2B action to handle industry standard docs such as edifact, AS2, RosettaNet etc.

Data Stitch

Allows you to build up a payload incrementally as your orchestration executes. The sample I have is banal, but does illustrate how this works. In this case I have an app driven integration with the following request and response - 
{
  "country": "Ireland",
  "OrderLine": [{
    "unitPrice": 4899,
    "product": "iBike",
    "quantity": 2,
    "lineNr": "1"
  }, {
    "unitPrice": 24899,
    "product": "iCar",
    "quantity": 2,
    "lineNr": "2"
  }],
  "OrderNr": "1",
  "customer": "NiallC"
}

Response - 

<nsmpr0:Order xmlns:nsmpr0="http://www.example.org">
   <nsmpr0:order>
      <nsmpr0:orderNr>1</nsmpr0:orderNr>
      <nsmpr0:productsOrdered>iBike</nsmpr0:productsOrdered>
      <nsmpr0:productsOrdered>iCar</nsmpr0:productsOrdered>
   </nsmpr0:order>
</nsmpr0:Order>

As you can see, the request is json, while the response is <xml>. The response xsd is as follows - 

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org"
            targetNamespace="http://www.example.org" elementFormDefault="qualified">
  <xsd:element name="Order">
    <xsd:complexType>
      <xsd:sequence>
     
        <xsd:element name="order" type="OrderType"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
   
    <xsd:complexType name="OrderType">
      <xsd:sequence>
     
      <xsd:element name="orderNr" type="xsd:string" minOccurs="1" maxOccurs="1" />
      <xsd:element name="productsOrdered" type="xsd:string" minOccurs="1" maxOccurs="unbounded" />
      
      </xsd:sequence>
 
    </xsd:complexType>
 
</xsd:schema>

First step was to create a global variable, based on the response payload.

Now to the initial Stitch - 

Now to the product Stitch, note I am taking the products from each order line.

Note, I use the Append operation here - 

The other operations supported are - 

Note the Logger action after the Append.

I run the integration - 

Healthcare

very similar to B2B, but for the Healthcare space - think HL7 and FHIR document processing. 

Logger

Logger we've met already. 

Map

I couldn't have said it better myself. Mapping is key to integrations and much of your development time will be spent on mapping. 

We've already touched this in previous labs, but just to recap - you have the following mapping support -

Simple drag and drop between source and target
Ability to create target nodes etc.
Here I create the target node - Status - and use the expression builder below to hard-code a value.

Note the builder is, per default, in View mode - so click on the Developer icon - 


 

Click on the Save icon - 







Ability to use built-in functions
XSLT function support

Note

Add a Note to your design. 

Notification

Send an email at any point in your orchestration -

Define Parameters to include payload fields in the email. e.g. "Your Order for an iBike has been approved."

Stage File

This is probably the most widely used action in OIC. As the name suggests, it is used for file processing. It deserves a post of its own, which is what you will get in a future post in this series.
























It is often used in concert with the FTP adapter.
You can use the FTP adapter to list files in a folder and then download those files to OIC. Think of OIC as having a virtual file system which you can leverage via Stage File actions.

Wait

Allows you to define a Wait. At runtime, the flow will pause for the number of seconds you have specified. There may be good business reasons for applying such - 


 
 
 




 










 
  
   










 

 

No comments: