Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
bhalchandraswcg
Contributor
In this blog, the limitations of the Content Enricher component are listed. Next, a solution to overcome said limitations is demonstrated with an example.

Content Enricher


Content Enricher is a message transformer that uses an external data source to augment a message with missing information [1].

Content Enricher in SAP Cloud Platform Integration


"The content enricher adds the content of a payload with the original message in the course of an integration process. This converts two separate messages into a single enhanced payload." [2].

Here are some blogs that demonstrate the use of Content Enricher using SuccessFactors adapter

Limitations



  • Only supports SuccessFactors, Soap1.x, and OData adapters

  • Only supports XML format

  • External data source services requiring a request body (other than the current one in the exchange) are not supported


Scenario


Let us consider a business use case showcasing limitations of Content Enricher component in SAP CPI.

Orders will be transferred from an Order Management System (OMS). The OMS exposes Order data using the OData protocol. The receiver wants the customer's information for each order in addition to the order data. A Customer Relationship Management System (CRM) maintains customer information and exposes the data as an HTTP service and supports JSON format only.


Note: Northwind Test Service is used to act as OMS and CRM [3].

Implementation


The key to the solution is the ProcessDirect adapter. The ProcessDirect adapter can be used to establish communication between integration processes within the same tenant [4].

External Data Source Integration Process


To overcome Content Enricher's limitations, we will prepare a separate integration process to

  • Invoke the external data source service using HTTP adapter but expose using ProcessDirect adapter

  • Prepare the response body in XML format


The External Data Source Integration Process expects orders having CustomerID. Then, the CustomerID filter is prepared to make the HTTP request to CRM. Next, service is invoked. Finally, JSON output is converted to XML format.

To Content Enricher, this integration process acts as External Data Source instead of CRM.


Main Integration Process


The main integration process

  1. Gets orders from OMS

  2. Uses Content Enricher with ProcessDirect adapter

  3. Logs the body




Content Enricher is configured as follows:


Example Run





Inside Main Integration Process


The main integration process runs once.

An example output of getting orders is
<Orders>
<Order>
...
<OrderID>10248</OrderID>
...
<CustomerID>VINET</CustomerID>
...
</Order>
<Order>
...
<OrderID>10249</OrderID>
...
<CustomerID>TOMSP</CustomerID>
...
</Order>
...
</Orders>

This will be supplied to the External Data Source Integration Process as input.

Inside External Data Source Integration Process


From the input, CustomerID filter is prepared for $filter parameter:

CustomerID eq 'VINET' or CustomerID eq 'TOMSP' ...


An HTTP GET request is performed













Endpoint https://services.odata.org/V2/Northwind/Northwind.svc/Orders
Query Parameters












$format JSON
$filter CustomerID eq 'VINET' or CustomerID eq 'TOMSP' ...


The output of the HTTP request


{
"d": {
"results": [
{
...,
"CustomerID": "TOMSP",
"CompanyName": "Toms Spezialitäten",
...
},
{
...,
"CustomerID": "VINET",
"CompanyName": "Vins et alcools Chevalier",
...
},
...
]
}
}

Finally, the output is converted to XML format ready to be used by Content Enricher
<d>
<results>
...
<CustomerID>TOMSP</CustomerID>
<CompanyName>Toms Spezialitäten</CompanyName>
...
</results>
<results>
...
<CustomerID>VINET</CustomerID>
<CompanyName>Vins et alcools Chevalier</CompanyName>
...
</results>
...
</d>

Note that further actions could be performed on XML data but are skipped to keep the example simple.

Examples of further actions can be

  • Removing the metadata and deferred links

  • Renaming d tag to Customers and results tag to Customer



Back to Main Integration Process


Order data is enriched with Customer details using Content Enricher and the body is logged.
<Orders>
<Order>
...
<OrderID>10248</OrderID>
...
<CustomerID>VINET</CustomerID>
<results>
...
<CustomerID>VINET</CustomerID>
<CompanyName>Vins et alcools Chevalier</CompanyName>
...
</results>
...
</Order>
<Order>
...
<OrderID>10249</OrderID>
...
<CustomerID>TOMSP</CustomerID>
<results>
...
<CustomerID>TOMSP</CustomerID>
<CompanyName>Toms Spezialitäten</CompanyName>
...
</results>
...
</Order>
...
</Orders>

Conclusion


In summary, using ProcessDirect adapter to develop an integration process to act as External Data Source has several advantages as follows:

  • Preparation of external data in XML format

  • The External Data Source can use any communication protocol and may expect body in the request payload

  • Extra transformations can be performed on data before feeding the data to Content Enricher


References


[1] Enterprise Integration Patterns - Content Enricher. 2018. Enterprise Integration Patterns - Content Enricher. [ONLINE] Available at https://www.enterpriseintegrationpatterns.com/patterns/messaging/DataEnricher.html. [Accessed 22 July 2018].

[2] SAP Help Portal. 2018. Define Content Enricher. [ONLINE] Available at: https://help.sap.com/viewer/fd940ad7e2034505a055f14e457c6d5b/Cloud/en-US/8827f9feb94e4264aaf42ac1c6c.... [Accessed 22 July 2018].

[3] https://services.odata.org/V2/Northwind/Northwind.svc

[4] SAP Help Portal. 2018. Configure Communication Channel with ProcessDirect Adapter. [ONLINE] Available at: https://help.sap.com/viewer/149e1c8f944645c79f7989e6ed7f5042/Cloud/en-US/74457187451f431298355fbbf80.... [Accessed 22 July 2018].

 

Authors

  • sanjali.salian01

  • bhalchandra.wadekar

8 Comments
Labels in this area