0% found this document useful (0 votes)
89 views22 pages

BTP 47

The document provides instructions for an exercise on replicating product data from a WebShop application to a Northwind application using SAP Integration Suite. Key steps include: 1. Copying three integration flows from a provided solution package into a new package created by the user. 2. The flows replicate product data from the WebShop application to a JMS queue, then to the Northwind application via OData APIs, ensuring asynchronous processing and idempotency. 3. Additional artifacts like message mappings and scripts are already provided and consumed to transform and process the data during replication.

Uploaded by

sprasadn66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views22 pages

BTP 47

The document provides instructions for an exercise on replicating product data from a WebShop application to a Northwind application using SAP Integration Suite. Key steps include: 1. Copying three integration flows from a provided solution package into a new package created by the user. 2. The flows replicate product data from the WebShop application to a JMS queue, then to the Northwind application via OData APIs, ensuring asynchronous processing and idempotency. 3. Additional artifacts like message mappings and scripts are already provided and consumed to transform and process the data during replication.

Uploaded by

sprasadn66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

openSAP Modernize Integration with SAP

Integration Suite

Solution
PUBLIC
EXERCISE: CLOUD INTEGRATION - SOLUTION

Guidelines

The openSAP course are very popular, and we welcome thousands of participants. The exercise described
in this document will be performed by hundreds of participants in parallel, using production tenants with
shared resources in a shared SAP Business Technology Platform (BTP) account. This means a few simple
things:

1. Use the tenant that we provide only for this exercise, and not for anything else. For further exploration
of Cloud Integration, use a free BTP trial account or a Free Tier tenant.

2. Do not share any private or personal information such as your name, email address or affiliation.

3. Please strictly follow the instructions, regarding the naming conventions you will use to name the
artifacts. This ensures that you will be able to successfully complete the tasks, without clashing
with other participants.

4. Other artifacts, created by other participants, will appear in your shared account. Do not access or
delete these artifacts. Please respect the rules and allow others to have the same learnings as
you.

5. Do not delete the Solution package from the tenant.

Your openSAP tenants were pre-configured by a competent technical BTP administrator, Cloud Integration
capability is already provisioned, and you already have all the roles and definitions you need to configure
and run this solution package.

Preparation
Please follow the below steps to make sure you have the right tenants and the details to run the solution
package.

1. The SAP Integration Suite tenant URL can be obtained from the system preparation document after
enabling your SAP Integration Suite tenant using the tenant booking application.

2. Copy and paste the Process Integration Client ID and Process Integration Client Secret obtained
from the tenant booking app and keep it handy in a notepad. We would need this to run the scenario.

2
Scenario Overview

In this sample scenario we like to replicate Product with associated entities i.e. Category and Supplier from
a WebShop Application to a Northwind Application using OData V2 APIs with asynchronous
decoupling and guaranteed delivery using internal message queues and JMS (Java Messaging Service)
adapter.

We also want to ensure idempotency, meaning that no duplicate products, categories, or suppliers should
be replicated in the target Northwind application. Let's break down the scenario for better understanding.

Components Involved:

1. WebShop Application: The source application where product data resides, including categories and
suppliers. We trigger the product replication using any external REST client by just sending the
Product Id and then the interface fetches the Product details along with Supplier and Category via
exposed OData V2 API.

2. Northwind Application: The target application where you like to replicate the data. It follows the
Northwind database schema and only provide OData V2 APIs without any user interface.

3. OData V2 APIs: Both the WebShop and Northwind applications expose OData V2 APIs for data
exchange.

4. Asynchronous Messaging with JMS: Instead of directly sending data to the Northwind Application,
we publish the data to a JMS queue for asynchronous processing and guaranteed delivery.

This decouples the replication process, ensuring that data is reliably delivered even if the Northwind
Application is temporarily unavailable.

5. Check for Idempotency: Before replicating any data, we also check whether it is already replicated in
the Northwind Application using an Idempotent Process Call to prevent duplication.

For each product, category, and supplier, we check whether a corresponding record with the same
unique identifier i.e., Product ID, Category Name, and Supplier ID is already replicated in the
Northwind Application or not.

6. Data Transformation Logic: Message Mapping artifacts are already created and deployed to map
the data structure for Product, Category, and Supplier from the WebShop application to match the
Northwind database schema.

7. Scripting Logic: Reusable groovy scripts are already created and deployed that provide some utilities
for Message Processing Logs (MPL), like writing payload attachments and custom headers with
business context i.e., Product ID.

8. Completion and Monitoring: Monitor the data replication process to ensure it completes
successfully.

Cloud Integration now provides a feature where users can consume reusable artifacts such as Message
Mapping and Script Collection Artifacts across different packages. This brings a better reusability experience
for our customers and the same is also demonstrated in this exercise.

As mentioned above, the message mapping and script collection artifacts are already created as part of the
solution package and deployed on the tenant, and we just consume the same during this exercise instead of
creating it again from scratch.

3
Note:
We haveNote:
also provided the solution package in the tenant and available as part of additional material as
The that
well solution
you package,
can refer to
as ifpart
youofrun
additional
into errors.
material can be refered to if you run into errors or in case you
want to consume and run the integration flows without creating on your own. Please follow the below steps.
In case you like to consume and run the integration flows without creating on your own as depicted in the
following steps, kindly check the solution documentation.

4
Task 1: Create your own Package

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Explanation Screenshot

Step 1. Open the “Tenant URL for


SAP integration Suite” from the
tenant booker application as
described in the Preparation phase
above.

Step 2. Navigate to “Design” ->


“Integrations” to create a new
Integration package for this
exercise.

Step 3. Press the “Create” button


to create your own Package.

5
Explanation Screenshot
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 4. Provide the following


properties:

Name:
openSAP_btp3_Week4_Exercise_###

Short Description:
In this exercise, we replicate
Product along with Category and
Supplier from WebShop to
Northwind application using OData
V2 test service.We'll cover Async
decoupling via JMS, Idempotent
Process Calls, Message Mapping
and Script Collection Artifacts, etc.

Version: 1.0.0

Press “Save”

6
Task 2: Copy Integration Flows from Solution Package to your own Package

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Explanation Screenshot

Step 1. Click on “Integrations” in


the breadcrumb navigation.

Step 2. Click and navigate to the


solution integration package
“openSAP_btp3_Week_4_Exerci
se_Solution”.

Step 3. Switch to “Artifacts” tab.

7
Explanation Screenshot

Step 4. Select the first integration


flow “JMS_to_Northwind
ProductReplication” and click on
Actions -> Copy to copy the flow
into your package.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 5. In the Copy dialog, suffix


the flow with your user id i.e.,
“JMS_to_Northwind
ProductReplication_###” and in
the package select the package
that you had created in Task 1 i.e.,
“openSAP_btp3_Week4_Exercis
e_###”

Step 6. Finally click on the “Copy”


button that result into the
“Success” dialog.

Click on “Cancel” to stop


navigating to your package as we
need to copy two more integration
flows.

Step 7. Select the second


integration flow “Northwind
Category_Supplier_Product_Enti
ty Replication” and click on
Actions -> Copy to copy the flow
into your package.

8
Explanation Screenshot
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 8. In the Copy dialog, suffix


the flow with your user id i.e.,
“Northwind
Category_Supplier_Product_Enti
ty Replication_###” and in the
package select the package that
you had created in Task 1 i.e.,
“openSAP_btp3_Week4_Exercis
e_###”

Step 9. Finally click on the “Copy”


button that result into the
“Success” dialog.

Click on “Cancel” to stop


navigating to your package as we
need to copy one more integration
flow.

Step 10. Select the third


integration flow
“WebShop_to_JMS
ProductReplication” and click on
Actions -> Copy to copy the flow
into your package.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 11. In the Copy dialog, suffix


the flow with your user id i.e.,
“WebShop_to_JMS
ProductReplication_###” and in
the package select the package
that you had created in Task 1 i.e.,
“openSAP_btp3_Week4_Exercis
e_###”

9
Explanation Screenshot

Step 12. Finally click on the


“Copy” button that result into the
“Success” dialog.

Click on “Navigate” to navigate to


your package as we have copied
all the three integration flows from
Solution package to your
integration package.

10
Task 3: Configure the copied Integration Flows and Deploy

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Explanation Screenshot

Step 1. Next you must add a


Number Range for the Category
ID. Therefore, navigate to
“Monitor”-> “Integrations” and
then select “Number Ranges” tile.

Note: The Northwind Service expects an


Integer as category id, while our source
(WebShop) is providing a string. By using a
Number Range, we can generate
incrementing Integer ids in Cloud
Integration.

Step 2. Click the “Add” button to


create a new Number Range
object.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 3. Provide the following


details:

Name: CategoryIDNRO_###
Description: NRO to auto
increment Category ID while
creating the Categories on
Northwind
Minimum Value: 3
Maximum Value: 999
Press “OK”

Note: This name we need in the later part


while configuring the copied integration
flows

11
Explanation Screenshot

Step 4. Navigate to “Design” ->


“Integrations” and open your
Integration package.
Select all the three copied
integration flows in your created
package and click on Actions ->
Configure to configure all the
three integration flows and deploy
it.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 5. Select the first integration


flow “JMS_to_Northwind
ProductReplication_###” and in
Sender tab, configure the JMS
Queue Name.
Queue Name:
webshop_products_###
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 6. Switch to Receiver tab,


configure the ProcessDirect
Receiver adapter address.

Address:
replicate_entities_###
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 7. Select the second


integration flow “Northwind
Category_Supplier_Product_Enti
ty Replication_###” and in
Sender tab, configure the
ProcessDirect Sender adapter
address.

Address:
replicate_entities_###

12
Explanation Screenshot

Important Info: To write data to


the Northwind OData V2 Service,
you need a unique endpoint.

Step 8. Request a unique endpoint


by opening this link and press
“Browse the Full Access (Read-
Write) Service”

Step 9. You will be redirected to a


URL with a unique ID. Copy the
whole URL to your notepad as it
will be required later.

Step 10. Switch to Receiver tab,


configure the Northwind OData
Receiver adapter address.

Address:
<Northwind URL that you have
obtained in step 9>

Step 11. Switch to More tab,


configure the Number Range
Object name that you had created
in step 3.

Category_ID_NRO:
CategoryIDNRO_###

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 12. Select the third


integration flow
“WebShop_to_JMS
ProductReplication _###” and in
Sender tab, configure the HTTPS
Sender adapter address.

Address: /###/products

Note: This should be unique per tenant,


else you will get an error in the deployed
artifact.

13
Explanation Screenshot
Step 13. Switch to Receiver tab,
configure the JMS Queue Name.

Queue Name:
webshop_products_###

Note: This should be same as you have


configured in step 5.

Step 14. Finally, click on “Deploy


All” button to deploy all the three
integration flows with the
configured values.

On “Confirmation” dialog, click on


the “Save” button.

14
Task 4: Test your scenario

Note:
In this exercise where required, replace the ‘###’ with a unique identifier, e.g., your UserID like user001.

Step 1. Switch to “Monitor” ->


“Integrations” to check the status
of your deployed integration flows

Step 2. Select the first tile under


“Manage Integration Content”
section.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 3. Now you can see all the


deployed Integration Flows. To
search for your created flow,
provide the integration package
name that you have created in
Task 1 i.e.,
openSAP_btp3_Week4_Exercise_###

All of you Integration Flows must


have Status “Started”.
In case an error occurred during
deployment, please check the
configuration section of this
documentation again.

15
Hint: Replace ‘###’ with a unique identifier
e.g., your user id

Step 4. Click on the Integration


Flow that was created in Task 1
i.e.,
WebShopToJMS_ProductReplic
ation_###

On the right side of the screen, you


will see the Endpoint of your
Integration Flow. Press the copy
button to copy the URL to your
notepad as we will require it later to
trigger the interface from any
REST client.

Note: You can use any REST client of your


choice like Postman or Insomnia but in this
exercise, we are using Postman.

Step 5. In order to call the


endpoint, open Postman and press
the “New” button to create a new
request.
Choose “HTTP” in the Popup.

Step 6. Change the HTTP


Operation to “POST” and paste
the endpoint that you had copied
in the previous step.

16
Step 7. You also need to add
Credentials. Therefore, switch to
the “Auth” or “Authorization” tab
and choose Type as
“Basic Auth”

Step 8. As Username you can add


the “Process Integration Client
ID” and as Password copy the
“Process Integration Client
Secret” that you got the tenant
booking application, see
Preparation section for more
details.

Step 9. Switch to “Body” tab and


select “raw”.

17
Step 10. Change the Content-Type
to “XML”

Step 11. Provide the following


payload:

<?xml version="1.0"?>
<Product>
<ProductId>HT-
1117</ProductId>
</Product>

Note: You can also replicate other products,


just explore the WebShop application via
this link.
Just select one Product from the list and
replace Product ID in the XML with the one
you want to replicate.

Step 12. Finally click the “Send”


button.

As response you should receive


“202 Accepted”.

18
Step 13. Jump back to the
Monitoring in the Integration Suite.
Select “Monitor” -> “Integrations”

Step 14. Click on the first tile “All


Artifacts” under “Monitor
Message Processing” section.

Hint: Replace ‘###’ with a unique identifier


e.g., your user id

Step 15. In the “Artifact” field,


search for your Integration
Package:
openSAP_btp3_Week4_Exercise_###

Select your Integration package to


see only messages processed by
your integration flows.

19
Step 16. You should see all three
Integration Flows executed and in
status “Completed”.

In case you see Status “Retry” or


“Error”, please check the
configuration section of this
documentation again.

Step 17. Click on the “>” icon on


the top left to expand the search
options.

In Custom Header put in following


value:

Product ID = <your ProductID>


e.g: Product ID = HT-1117

Press “Enter”.
Now the messages are filtered
based on the custom header. You
can also see all Customer Headers
of one Message on the details
page.

Step 18. To validate whether the


product data along with associated
Category and Supplier is replicated
to Northwind application or not,
enter the following URL in the
browser, you should see the details
as shown in the given screenshot.

<Northwind URL that you have


obtained in step
2>/Products(1117)?$expand=Cat
egory,Supplier

E.g.,
https://services.odata.org/V2/(S(i
bagny0nu0lgbi3gzvvvto42))/ODa
ta/OData.svc/Products(1117)?$e
xpand=Category,Supplier

20
Note: While replicating the product from
WebShop to Northwind application, we
remove the “HT-” prefix, so whenever you
search the product in Northwind, just search
it without “HT-”

Step 19. In case you see retry in


your message process logs (MPL).
Fix the issue and then you can
retrigger the process from the JMS
Queue itself.
Navigate to “Monitor” ->
“Integrations” -> “Manage Stores”
-> “Message Queues”.
Then select your queue and
message to retrigger the process
as shown in the screenshot.

Step 20. If you run the scenario


again from Step 12 by giving the
same Product ID, you will observe
that you have only two integration
interfaces in completed state and
one will have the Custom Header
Is Product Duplicate = true

This means that due to Idempotent


Process call, the duplicate product
ID is not processed further and
simply exited.

Congratulations! You have successfully completed the exercise.

21
Coding Samples
Any software coding or code lines/strings (“Code”) provided in this documentation are only examples and are not intended for use in a production system environment. The Code is only intended to better
explain and visualize the syntax and phrasing rules for certain SAP coding. SAP does not warrant the correctness or completeness of the Code provided herein and SAP shall not be liable for errors or
damages cause by use of the Code, except where such damages were caused by SAP with intent or with gross negligence.

www.sap.com/contactsap

© 2021 SAP SE or an SAP affiliate company. All rights reserved.


No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable
for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality
mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are
all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation
to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are
cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other
countries. All other product and service names mentioned are the trademarks of their respective companies. See www.sap.com/trademark for additional trademark information and notices.

You might also like