Posts

HTTP Retry - Groovy + Looping Process Call

Image
This blog post will cover the HTTP Retry process using a Groovy script and Looping process call combination. Sometimes, we get a temporary time out error on the HTTP endpoint. To tackle this, we can use this mechanism to do a http retry for a specific interval / specific number of times.  Overall iFlow Design: Set Properties in Content modifier: For the Groovy script to work, we need to declare the below properties. Looping Process Call: HTTP Retry Groovy Script: If the HTTP Response code is greater than or equal to 400, the script will retry depending on the retry_interval and retry_limit properties. ------------------------------------------------------------------------------------------------------------- import com.sap.gateway.ip.core.customdev.util.Message; import java.util.HashMap; def Message processData(Message message) {         def map = message.getHeaders();         def  httpStatusCode = map.get("CamelHttpResponseCode") as In...

XSLT Mapping - Extract Integer value

Image
 I had a requirement where in we wanted to extract the km value from a node value. Input XML Example: ------------------------------------------------------------------------------- <root> <test>Nasik 180km Bombay</test> </root> ------------------------------------------------------------------------------- XSLT Mapping used: ------------------------------------------------------------------------------- <xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:output omit-xml-declaration="yes" indent="yes"/>  <xsl:strip-space elements="*"/>  <xsl:template match="/*">      <xsl:value-of select=       "translate(.,translate(., '0123456789', ''), '')"/>  </xsl:template> </xsl:stylesheet> ------------------------------------------------------------------------------- Output: ----------------------------...

Content Modifier - Concatenate Array Inputs ( Dynamic Parent Node)

Image
   Requirement is to extract the repeated XML node with Dynamic Parent Nodes. Here, we are passing the below payload directly in Content Modifier - Message Body -------------------------------------------------------------------------------------------------------------------- <message>     <header>       <messageId>1</messageId>       <masterMsgId>33300453700</masterMsgId>       <equipment>         <serialNumber>API TestSNVin</serialNumber>         <make>CAT</make>         <model>D100</model>         <nickname>API Test Asset</nickname>       </equipment>       <moduleCode>API TestDeviceSN</moduleCode>       <moduleTime>2022-02-16 10:45:14</moduleTime>       <recei...

Content Modifier - Concatenate Array Inputs

Image
 Requirement is to extract the repeated XML node with Static parent node. Step 1 - Here, I am passing input in the Content modifier itself. Sample Input: <Root> <Employee> <Name>Akshay</Name> <ID>1</ID> </Employee> <Employee> <Name>Sudeep</Name> <ID>2</ID> </Employee> <Employee> <Name>Advik</Name> <ID>3</ID> </Employee> <Employee> <Name>Hirva</Name> <ID>4</ID> </Employee> </Root> ----------------------------------------------------------------------------------------------------------------------------- Step 2 : Declare Property variables to hold the output. Name_Concat  string-join(/Root/Employee/Name, ",") ID_Concat  string-join(/Root/Employee/ID, ",") Below is the config. of the message body tab of the content modifier: -------------------------------------------------- ...

Global Data Store & Variable

Image
 The first iFlow shows how to write a variable (Global) and Write the incoming data to a Data Store. Whereas, in the second iFlow we will fetch data from the data store which was declared in the first iFlow.  First iFlow (Producer) Address : https://refapp-espm-ui-cf.cfapps.eu10.hana.ondemand.com/espm-cloud-web/espm.svc   Write Variable: Write Variables are used to share data across different integration flows (deployed on the same tenant). To consume the variable (either in another step of the same integration flow or in another integration flow), can use a Content Modifier. A variable gets expired after the retention period which is 400 days. Data Store Write Operation: This step performs a Write operation on the transient data store. Entry ID Specify an entry ID that is stored together with the message content. The entry ID must not exceed 255 characters. Details for the entry ID are read from the incoming message. ...

XML to CSV Conversion

Image
 Input to Content Modifier: -------------------------------------------------------------------------------------------------------- <Records>                 <Header>                                 <FieldA>H_ABC</FieldA>                                 <FieldB>H_123</FieldB>                                 <FieldC>H_XXX</FieldC>                                 <FieldD>H_567890</FieldD>                 </Header>                 <Line>             ...

General Splitter

Image
 Demo Scenario : Content Modifier: Body  --------------------------------------------------------- <root xmlns="demo.sap.com"> <shop> <customerReview> <id>001</id> <rating>4</rating> </customerReview> <customerReview> <id>002</id> <rating>1</rating> </customerReview> <customerReview> <id>003</id> <rating>1</rating> </customerReview> <customerReview> <id>004</id> <rating>1</rating> </customerReview> <customerReview> <id>005</id> <rating>1</rating> </customerReview> </shop> </root> --------------------------------------------------------- Please also refer to the below blog for elaborative analysis : https://blogs.sap.com/2020/09/21/sap-cloud-platform-integration-general-splitter/