In this lesson, the following topic is discussed:
Mappings in an overview.
Mappings in an Overview
The following mapping types are available:
- Message Mapping.
- XSLT Mapping.
- Mapping with Scripting.
- Operation Mapping from Enterprise Service Repository (On-Premise).
- Message Mapping
The Java SDK for message mapping and user-defined functions (UDFs) is the same as for the process integrations. To use them, you need the body in XML or JSON format. The source and destination mapping can be defined using one of the following file types:
- XML Schema Definitions (XSD)
- OData V2/V4 metadata files with .edmx or .xml extensions
- WSDL
- Swagger/OpenAPI Spec JSON file
Mapping Editor
This lesson does not involve the use of a message mapping. The mapping editor, however, provides all the necessary tools to map XML or JSON messages.
- No. 1: Adding the source structure.
- No. 2: Adding the target structure.
- No. 3: The actual assignment of the values depending on the context.
- No. 4: Other representation of the mapping.
- No. 5: Simulation of the mapping with a source file.
- No. 6: Define a user defined function (UDF).
Testing
We can test/simulate the mapping using the monitor.
Implemented Samples via Guidelines
- Guidelines to Implement Specific Integration Patterns Content Filter → Variant: Message Mapping: Guidelines to Implement Specific Integration Patterns
- Guidelines to Implement Specific Integration Patterns Splitter → Variant with Message Mapping: Variant with Message Mapping
- Learn the Basics → Access Header and Properties → Access Header and Properties in Message Mapping: Access Header and Properties in Message Mapping
Implemented Samples via Tutorials, Missions, and Blogs
Videos
Read more here:
- XSLT Mapping
XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text, or XSL Formatting Objects, which can subsequently be converted to other formats, such as PDF. A style sheet is processed by an XSLT processor such as Xalan or Saxon. Both are included in every Java SDK. We use XSLT mapping in the exercises. There is a helpful online editor, Groovy IDE for easy development and testing of your scripts.
Sample
This example copies the content of the source file without any namespaces and their corresponding prefixes, and generates a target file.
The namespaces are:
- xmlns:m=„http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d=„http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base=„https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/"
This is necessary to be able to access the contents of the response via XPATH.
The XSL stylesheet creates the result document through a template that only includes the original element names and attributes.
The result after transformation:
Testing and Limitations
Testing XSLT mapping requires deploying the integration flow or using external tools. Without deployment, testing is not possible. To speed up the tasks related to integration flow transport, testing, and error handling, you can use tools like the DOST Add-on.
Implemented Samples via Guidelines
Learn the Basics → Access Header and Properties → Access Header and Properties in XSLT Mapping: Access Header and Properties in XSLT Mapping
Blogs
Read more here:
- Mapping with Scripting
Mappings can also be implemented using Groovy or JavaScript.
Sample
In this example, the list of order items is restructured in a different way.
The source JSON Payload:
Testing
Testing of Groovy script mapping can be done by deploying the integration flow or using external tools. It is not possible to test without deploying it.
Read more here:
- Operation Mapping from Enterprise Service Repository (On-Premise)
To save time and effort when creating integration content, you can import existing content from your ES repository directly into Cloud Integration. To do so, you must configure the connection settings to connect to the On-Premise ES system through Cloud Connector. This allows you to reuse previously created integration content and avoid redundant work in the Cloud Integration web application.
Import Content from ESR
Once you have configured the connection to the ES Repository, you can proceed to import the content from it through the "Resources" tab in the integration flow editor. Now, you are able to import:
- Message mapping
- Value mapping
- Operation mapping
- WSDL
Read more here:
- Importing Content from ES Repository
- Configuring Connectivity to ES Repository
- Importing Mapping Content from ES Repository
- Importing Message Mapping from ES Repository in SAP Cloud Integration | SAP Blogs
- Cloud Connector Configuration to Import Message Mapping from ES Repository into SAP Cloud Platform Integration | SAP Blogs
Summary
Mapping is the process of converting a source format into a different target format using various techniques in SAP Cloud Integration. The source and target structures must first be defined, which can be done via XSDs, WSDLs, and more definitions in message mapping. The Message Mapping Editor, which offers context handling, user-defined functions, and testing options, is used for the build-in variant of mapping in XML and JSON formats. The XSLT procedure, which requires XML as an input format and offers a simple editor, can create more target formats and is useful for creating attachments. Testing is done via integration flow deployment or external tools like XML Spy. Mapping via scripting offers the greatest degree of freedom in terms of source and target formats and requires a written language that supports the formats, such as XMLSlurper for Groovy scripting language. Testing here is also done via integration flow deployment or external tools like IntelliJ IDEA. If all data structures such as XSD and WSDLs are already created in the Enterprise Service Repository, message mapping can be connected and used.