Saturday, February 26, 2022

XML to CSV Conversion

 Input to Content Modifier:

--------------------------------------------------------------------------------------------------------


<Records>


                <Header>


                                <FieldA>H_ABC</FieldA>


                                <FieldB>H_123</FieldB>


                                <FieldC>H_XXX</FieldC>


                                <FieldD>H_567890</FieldD>


                </Header>


                <Line>


                                <Field1>ABC</Field1>


                                <Field2>123</Field2>


                                <Field3>XXX</Field3>


                                <Field4>567890</Field4>


                </Line>


                <Line>


                                <Field1>XYZ</Field1>


                                <Field2>456</Field2>


                                <Field3>YYYY</Field3>


                                <Field4>98765</Field4>


                </Line>


</Records>

--------------------------------------------------------------------------------------------------------------------





------------------------------------------------------------------------------------------------------

When configuration of XML to CSV:



Output:




------------------------------------------------------------------------------------------------------

Config : 



Output:





------------------------------------------------------------------------------------------------------


Config:



Output:




------------------------------------------------------------------------------------------------------


Config:

 


Output:



-----------------------------------------------------------------------------------------------------------------------------


Thursday, February 24, 2022

General Splitter




 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/






Wednesday, February 23, 2022

CSV to XML - Demo

 The converter element enables you to transform an input message in one format to another. 


Input:

123, Akshay, CPI Consultant

456, Akshada, Professor



CSV to XML Converter :

XML Schema:
Choose Browse and select the file path to the XML schema file that is used as the basis for message transformation. The XML file schema format is used as the basis for creation of the payload. 

Path to Target Element in XSD :
XPath in the XML Schema File where the content from CSV has to be placed. 

Record Marker in CSV :
The corresponding record in the CSV file that has to be considered for conversion. This entry is the first text in every new record of the CSV. 
If this value is not specified then all the records would be considered for conversion.

Field Separator :

If we want to use a field separator that is not available in the dropdown list, manually enter the character in Field Separator in CSV field.

If you want to exclude headers in the first line of CSV file for conversion, select Exclude First Line Header checkbox. 
If the checkbox is not selected, then the attributes of the CSV file are mapped according to the order of occurrence in the XSD.


 


Path to Target Element in XSD :

CompetencyList/Competency



Output:

---------------------------------------------------------

<?xml version='1.0' encoding='UTF-8'?>

<CompetencyList>

<Competency>

<id>123</id>

<name> Akshay</name>

<description> CPI Consultant</description>

</Competency>

<Competency>

<id>456</id>

<name> Akshada</name>

<description> Professor</description>

</Competency>

</CompetencyList>

---------------------------------------------------------



--------------------------------------------------------------------------------------------------------------------------
XSD used:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Technologies Online Tools 1.0 (https://www.liquid-technologies.com) -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="CompetencyList">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Competency">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="id" />
              <xs:element name="name" />
              <xs:element name="description" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

--------------------------------------------------------------------------------------------------------------------------

Important Points:

  • If the CSV file has more fields then the XML schema fields , the converter will ignore the additional fields form the CSV
--------------------------------------------------------------------------------------------------------------------------


Message Digest

 Used to calculate a digest of the payload or parts of it and store the result in a message header.

We can transform part of the message, enter an XPath expression to specify the part (optional attribute). Can also define a prefix namespace mapping.

Hash 








Address:  https://refapp-espm-ui-cf.cfapps.eu10.hana.ondemand.com/espm-cloud-web/espm.svc/









Target Header Name:

Enter the name of the target header element which is to contain the hash value (digest). This is a mandatory attribute





When tested first (without changing anything in the payload), the below MD5 hash was generated :

AVWgPTQU1b/X/YC/4ANlwA==







--------------------------------

On the second test run, we added a new customer review in the OData WebShop API ( so we get a different response compare to earlier to view the disparity in MD5 Values)




Can see below the customer review was added in the Response Payload:



 As the response (input to MD5) has been changed, the resulted MD5 hash value should also be changed.

New MD5 Hash value :
rFH0pP+laZpYaZ7D13mniQ==

See the below Header (Name as per given in the configuration)



Data Store Screen:







Filter

When to use Filter?

->  if want to filter information by extracting a specific node from the incoming message.


What are different value types?

-> 



Sample XML Payload: (to put inside Body of Content Modifier)

----------------------------------------

<Message>

<orders>

 <order>

 <clientId>I0001</clientId>

 <count>100</count>

 </order>

 <order>

 <clientId>I0002</clientId>

 <count>10</count>

 </order>

</orders>

</Message> 

-------------------------------------------------

iFlow:


Content Modifier:



With value type as ' Integer '




With value type as Boolean :





With Value type as 'Node' : (only first occurrence of node is considered)




With Value type as 'Nodelist'  (All <count> nodes are considered )






Tuesday, February 22, 2022

Receiver Mail Adapter - Basics

 Address : 

Specifies the host name and (optionally) a port number of the SMTP server. 

Use one of the following open ports for external mail servers: 

  • 25 and 587 for SMTP+STARTTLS

  • 465 for SMTPS If you are using GMail Server, make sure that you allow insecure applications (GMail considers only communication based on OAuth2 as secure) when configuring the server. 

  • Can use port 25 for connections to GMail server.

--------------------------------
If you want to configure multiple mail receivers, use a comma (,) to separate the addresses.

The parameters From, To, Cc, Bcc, Subject, Mail Body as well as the attachment name, can be dynamically set at runtime from message headers or content.