sdn community contribution · 2019-11-12 · system using xi. the communication between tibco and...

38
Step-By-Step Approach for Implementing XI Scenarios © 2005 SAP AG The SAP Developer Network: http://sdn.sap.com SDN Community Contribution (This is not an official SAP document.) Disclaimer & Liability Notice This document may discuss sample coding or other information that does not include SAP offic and therefore is not supported by SAP. Changes made based on this information are not suppor be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, cod suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect this technical article or code sample, including any liability resulting from incompatibilit within this document and the materials and services offered by SAP. You agree that you will to hold, SAP responsible or liable with respect to the content of this document. 1

Upload: others

Post on 03-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

SDN Community Contribution

(This is not an official SAP document.)

Disclaimer & Liability Notice

This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

1

Page 2: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 2

Applies To:

SAP NW04 – SAP XI 3.0 (SP14)

Summary

In this document I have explained step-by-step how to develop “Web Service to RFC”, “HTML to Web Service” and “File to Database using BPM” scenarios.

By: Mukeshlal Parida

Company: Infosys Technologies Limited

Date: 15 Nov 2005

Page 3: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 3

Table of Contents

SDN Community Contribution ..........................................................................................................1

(This is not an official SAP document.) ............................................................................................1

Disclaimer & Liability Notice.............................................................................................................1

Applies To:........................................................................................................................................2

Summary ..........................................................................................................................................2

Table of Contents .............................................................................................................................3

Introduction .......................................................................................................................................5

How Messages Flow In XI................................................................................................................5

1 Web Service to RFC scenario...................................................................................................7

1.1 Interface Landscape............................................................................................................7

1.2 Step by Step Approach for Web Service to RFC Scenario.................................................8

1.2.1 System Landscape Directory ..................................................................................8

1.2.2 Integration Repository .............................................................................................8

1.2.3 Integration Directory ..............................................................................................11

1.2.4 Sender System........................................................................................................15

1.2.5 Receiver system .....................................................................................................15

1.2.6 Unit Testing.............................................................................................................15

2 HTML To Web Service Scenario ............................................................................................16

2.1 Interface Landscape..........................................................................................................16

2.2 Step by Step Approach for HTML to Web Service scenario.............................................16

2.2.1 System Landscape Directory ................................................................................16

2.2.2 Integration Repository ...........................................................................................17

2.2.3 Integration Directory ..............................................................................................19

2.2.4 Sender Service........................................................................................................22

2.2.5 Receiver Service.....................................................................................................22

2.2.6 Unit Testing.............................................................................................................22

3 FILE TO DATABASE USING BPM .........................................................................................23

Page 4: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 4

3.1 Interface Landscape..........................................................................................................23

3.2 Step by Step Approach for File to Database Scenario using BPM...................................24

3.2.1 System Landscape Directory ................................................................................24

3.2.2 Integration Repository ...........................................................................................24

3.2.3 Integration Directory ..............................................................................................29

3.2.4 Unit Testing.............................................................................................................35

Author Bio.......................................................................................................................................38

Page 5: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

Introduction

In this document I will explain the detailed step-by-step approach of how to develop “Web Service to RFC”, “HTML to Web Service” and “File to Database using BPM” scenarios. Also how to test the scenarios has been explained at the end of each scenario.

SAP is the core system and it interacts with a host of external systems via the Middleware layer - SAP Exchange Infrastructure (SAP XI).

SAP XI is much more than a simple Integration tool. It can execute business processes across business applications. It is used for integrating SAP and non-SAP applications, for A2A and B2B integration, for asynchronous and synchronous communication and cross component business process management.

SAP XI is open and flexible and is based on open standards like XML (XSD), WSDL, BPEL and SOAP messaging for describing objects and communicating with other systems .

How Messages Flow In XI

XI connects various applications via XML messaging using SOAP protocol. Messages received at the IS are processed through a defined series of steps called Pipeline Services.

The different pipeline steps are;

Receiver Identification:

Determine which systems should participate in an exchange with the incoming message.

Interface Determination:

For each receiver system determine which interfaces should receive a message.

Message Branch:

5

Page 6: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 6

If multiple receivers are found, XI will instantiate a new message for each receiver.

Request Message Mapping:

Call the mapping program to transform the message structure to the receiver format.

Technical Routing:

Bind a specific destination and protocol to the message.

Call Adapter:

Send the transformed message to the adapter or proxy.

Interfaces are classified based on Direction with respect to the SAP XI system.

Outbound: All interfaces for which data in the form of files or IDOC or RFC messages is received by the middleware from the external systems are considered to be “outbound” interfaces.

Inbound: Message going out of SAP XI system to external systems in the form of files, IDOC or RFC is considered as inbound message.

Messages coming into XI are called as inbound message and going out of XI is called as outbound message.

Page 7: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

1 Web Service to RFC scenario 1.1 Interface Landscape

Application system is sending data to TIBCO. After processing the data, TIBCO sends the data to SAP R/3 system using XI.

The communication between TIBCO and XI is though Web Service call.

So XI exposes an interface as a Web service which becomes a service provider.

7

Page 8: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 8

TIBCO makes a Web service call to the XI service provider.

After processing the message XI makes an RFC call to R/3 system.

SAP R/3 system sends a response back to XI which in turn is sent back to TIBCO web service client.

1.2 Step by Step Approach for Web Service to RFC Scenario

To configure the Web Service to RFC (SAP R/3) scenario follow the following steps

1.2.1 System Landscape Directory

In the SLD create the following components in order.

Step 1

Under Software Catalog create software component and Product

Step 2

Under Technical Landscape create technical systems

Step 3

Under Business Landscape create two business systems;

TIBCODEV_100

IDESDEV_600

1.2.2 Integration Repository

In the Integration Repository (Designer) create the following objects.

Step1

From the menu bar, Tools -> Transfer from SLD-> Import software component versions

Select the software component ‘INFOSYS_TIBCO’ and import it.

Step2

After importing it select it from the navigation bar and right click on it to create a namespace

http://infosys.com/demo/webservice_scenario for TIBCODEV_100 business system and

http://infosys.com/demo/IDESDEV_600 for IDESDEV_600 and save it.

Step3

Under the above namespace -> Interface Objects-> Data Types right click and create

‘FinancialRequest_dt’ and ‘FinancialResponse_dt’.

It has the below structure;

Page 9: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 9

FinancialRequest_dt

Structure Category Type Occurrence Header Element String 1:1 OrderID Element 1:1 DateofCreation Element 1:1 Company 1:1 BodyItem Element String 1:N Type Element String 0:1 Quantity Element String 0:1 Price Element String 0:1 DeliveryDate Element String 0:1

FinancialResponse_dt

Structure Category Type Occurrence Return Element String 1:1 item Element String 0:N OrderID Element String 0:1 Status Element String 0:1

Step4

Under Message Types right click and create ‘FinancialRequest_mt’ and select the data type as ‘FinancialRequest_dt’ and ‘FinancialResponse_mt’ and select the data type as ‘FinancialResponse_dt’. Save it.

Step5

Under Message Interfaces right click and create ‘Financial_SYNC_OB’. In this select category as Outbound and Mode as Synchronous. In this select Output message as

‘FinancialRequest_mt’ and Input message as ‘FinancialResponse_mt’.

Step6

While downloading the software component from SLD select the option “Import of RFC and IDoc Interfaces from SAP Systems Permitted.”. Under this software component and under Imported Objects RFCs and IDocs can be imported. Right click on it which will lunch a wizard in which provide the details to connect to the R/3 system and import the RFC “ZBAPI_TIBCO_Finance”.

It has the below structure;

ZBAPI_TIBCO_Finance

Structure Category Type Occurrence S_EPHDR Element String 1:1

SAPTDID Element String 1:1 DSTDAT Element Date 1:1 COMCOD Element String 1:1 I_EPITM Element String 1:N

TYPE Element String 0:1 QUANTITY Element String 0:1

Page 10: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 10

PRICE Element String 0:1 MODDAT Element Date 0:1

ZBAPI_TIBCO_Finance.Response

Structure Category Type Occurrence I_RETURN Element 0:1 Item Element 0:N TYPE Element String 0:1 ID Element String 0:1 NUMBER Element String 0:1 MESSAGE Element String 0:1 LOG_NO Element String 0:1 LOG_MSG_NO Element String 0:1

Step7

Under Mapping Objects-> Message Mappings right click and create

“MM_FinancialRequest_mt_To_ZBAPI_TIBCO_Finance”. Select the messages tab and select ‘FinancialRequest_mt’ under Source Messages and ‘ZBAPI_TIBCO_Finance’

Under Target Messages. Under the Design tab do the following mapping.

MM_FinancialRequest_mt_To_ZBAPI_TIBCO_Finance

Source Message Type Element Target Message Type Element Functions to be used

FinancialRequest_mt ZBAPI_TIBCO_Finance Header S_EPHDR OrderID SAPTDID DateofCreation DSTDAT Company COMCOD BodyItem I_EPITM Type TYPE Quantity QUANTITY Price PRICE DeliveryDate MODDAT

Create another message mapping

“MM_ZBAPI_TIBCO_FinanceResponse_To_FinancialResponse_mt”. Select ‘ZBAPI_TIBCO_Finance.Response’ as the source message and ‘FinancialResponse_mt’ as the target message.

MM_ZBAPI_TIBCO_FinanceResponse_To_FinancialResponse_mt

Source Message Type Element Target Message Type Element Functions to be used

FinancialRequest_mt ZBAPI_TIBCO_Finance Return I_RETURN item Item

Page 11: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 11

OrderID ID Status MESSAGE

Step8Under Interface Mappings create

“IM_Financial_SYNC_OB_TO_ZBAPI_TIBCO_Finance” and select Source Interface as

Financial_SYNC_OB and target interface as ZBAPI_TIBCO_Finance and request mapping as MM_FinancialRequest_mt_To_ZBAPI_TIBCO_Finance and response mapping as MM_ZBAPI_TIBCO_FinanceResponse_To_FinancialResponse_mt

1.2.3 Integration Directory

In the Integration Directory from the menu bar select Object-> New and create a scenario called

“INFY_WebService_TO_BAPI” and save it.

Step1

Select Service Without Party-> Business System. Right click and select business systems

TIBCODEV_100 and IDESDEV_600.

Step2

Under business system TIBCODEV_100 create a communication channel called “SOAP_SND_TIBCO_Financial_001” and under IDESDEV_600 create “RFC_RCV_SAP_001”.

Step3 Configure SOAP_SND_TIBCO_Financial_001 as below;

Page 12: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

Step4

Configure RFC_RCV_SAP_001 as below;

12

Page 13: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

Also specify Logon User, Logon Password, Logon Language as EN, Logon Client and Maximum Connections according to your environment.

Step5 Create sender agreement with following parameters;

Sender

Service: TIBCODEV_100

Interface: Financial_SYNC_OB

Namespace: http://infosys.com/demo/webservice_scenario

Receiver

Service: IDESDEV_600

Sender Communication Channel: SOAP_SND_TIBCO_Financial_001

13

Page 14: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 14

Create receiver agreement with following parameters;

Sender

Service: TIBCODEV_100

Receiver

Service: IDESDEV_600

Interface: ZBAPI_TIBCO_Finance

Namespace: http://infosys.com/demo/IDESDEV_600

Receiver Communication Channel: RFC_RCV_SAP_001

Step6 Create Interface Determination and use the below objects;

Sender

Service: TIBCODEV_100

Interface: Financial_SYNC_OB

Namespace: http://infosys.com/demo/webservice_scenario

Receiver

Service: IDESDEV_600

And select Inbound Interface ZBAPI_TIBCO_Finance and Interface Mapping as

IM_Financial_SYNC_OB_TO_ZBAPI_TIBCO_Finance.

Step7 Create Receiver Determination and use the below objects;

Sender

Service: TIBCODEV_100

Interface: Financial_SYNC_OB

Namespace: http://infosys.com/demo/webservice_scenario

Receiver

Party: *

Service: *

And in Configured Receivers select service as IDESDEV_600. Save it.

Step8 From the menu bar select Tools-> Define Web Service

>Under specify URL select propose URL. This will give

Page 15: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 15

http://blrkecsaptst2:8000/sap/xi/engine?type=entry. Basically this the URL of the XI

Server.

>Select the interface Financial_SYNC_OB.

>Specify the sender Service: TIBCODEV_100

Interface: Financial_SYNC_OB

Namespace: http://infosys.com/demo/webservice_scenario

Save it and it will generate the WSDL file.

1.2.4 Sender System

Import the WSDL file created in the above step in the TIBCO which will act as web service client. This WSDL will have both request and response structure.

1.2.5 Receiver system

Here the SAP R/3 system is the receiver system. We have to create the RFC ZBAPI_TIBCO_Finance in SAP system which will be downloaded within the Integration Repository.

1.2.6 Unit Testing

For testing we need to have TIBCO system acting as Sender and SAP R/3 as receiver. Otherwise we can use any standard web service testing tools.

This will show you the input parameters. Fill the input prams and give authentication details (username and password to connect to SAP XI server). Click send. Then you will get the response back from the SAP R/3 system.

Page 16: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

2 HTML To Web Service Scenario This scenario involves calling a web service from HTML client using SAP XI as middleware.

Here we will call a SMS web service which will send SMS to the concerned people depending on some business logic.

2.1 Interface Landscape

This scenario can be modified in a number of ways using complex BPM to meet the real life requirements like alerting support issues by SMS.

But for learning prospective we will configure it to see how data can be sent from HTML to web service and get the response back and send SMS from the web service.

Here HTML client sends data through XI to make a Web Service call.

So XI acts as a web service client on behalf of HTML client and makes the web service call.

This web service will send a SMS based on some condition/business logic to the concerned people.

Web service will also send a response back to HTML client about the status of the call.

2.2 Step by Step Approach for HTML to Web Service scenario

To configure the HTML to Web Service scenario follow the following steps

2.2.1 System Landscape Directory

No need to configure any business systems in the SLD as we will use Business service for both HTML and Web Service.

Create a generic software component in SLD called “Infosys_HTML_WebService”.

16

Page 17: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 17

2.2.2 Integration Repository

In the Integration Repository (Designer) create the following objects.

Step1

From the menu bar, Tools -> Transfer from SLD-> Import software component versions

Select the software component ‘Infosys_HTML_WebService’ and import it.

Step2

After importing it select it from the navigation bar and right click on it to create a namespace

http://infosys.com/demo/HTML for HTML_BS business service and

http://infosys.com/demo/SMSWebService for SMSWebService_BS and save it.

Step3

Under namespace ‘http://infosys.com/demo/HTML’ Interface Objects-> Data Types right click and create

‘SupportRequest_dt’ and ‘SupportResponse_dt’.

It has the below structure;

SupportRequest_dt

Structure Category Type Occurrence Header Element 1:1 ReceiptantMobileNumber Element String 1:1 FromEmailAddress Element String 1:1 BodyItem Element 1:N Message Element String 0:1 DeliveryDate Element String 0:1

SupportResponse_dt

Structure Category Type Occurrence MessageStatus Complex Type FromEmailAddress Element String 0:1 ReceiptantMobileNumber Element String 0:1 Provider Element String 0:1 State Element String 0:1 Status Element String 0:1

Page 18: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

Step4

Under the namespace ‘http://infosys.com/demo/HTML’, right click on Message Types and create ‘SupportRequest_mt’ and select the data type as ‘SupportRequest_dt’ and ‘SupportResponse_mt’ and select the data type as ‘SupportResponse_dt’. Save it.

Step5

Under Message Interfaces right click and create ‘SupportMessage_SYNC_OB’. In this select category as Outbound and Mode as Synchronous. In this select Output message as

‘SupportRequest_mt’ and Input message as ‘SupportResponse_mt’.

Step6

Under namespace http://infosys.com/demo/SMSWebService,

Interface Objects-> External Definitions right click and create an object called SMSWebService. In the File, browse and select the WSDL file. PFA of the file here of you can download it from “http://www.webservicex.net/SendSMS.asmx?WSDL”

SendSMS.asmx

Step7

Create Message Interface called “SendSMSToIndia_SYNC_IB”. In this select category as Inbound and Mode as Synchronous. In this select Input message as

‘SendSMSToIndiaSoapIn’ and Output message as ‘SendSMSToIndiaSoapOut’.

Step8

Under namespace http://infosys.com/demo/HTML, Mapping Objects-> Message Mappings right click and create

“MM_SupportRequest_mt_To_SendSMSToIndiaSoapIn”. Select the messages tab and select ‘SupportRequest_mt’ under Source Messages and ‘SendSMSToIndiaSoapIn’

Under Target Messages. Under the Design tab do the following mapping.

MM_SupportRequest_mt_To_SendSMSToIndiaSoapIn

Source Message Type Element Target Message Type Element Functions to be used

SupportRequest_mt SendSMSToIndia Header ReceiptantMobileNumber MobileNumber FromEmailAddress FromEmailAddress BodyItem Message Message Use concat with delimiter as

“ on: “ For concating Message and

18

Page 19: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 19

DeliveryDate and map it to Message on the target side.

DeliveryDate

Create another message mapping

“MM_SendSMSToIndiaSoapOut_To_SupportResponse_mt”. Select ‘SendSMSToIndiaSoapOut’ as the source message and ‘SupportResponse_mt’ as the target message.

MM_SendSMSToIndiaSoapOut_To_SupportResponse_mt

Source Message Type Element Target Message Type Element Functions to be used

SendSMSToIndiaReponse SupportResponse_mt SendSMSToIndiaResult MessageStatus FromEmailAddress FromEmailAddress MobileNumber ReceiptantMobileNumber Provider Provider State State Status Status

Step8

Under Interface Mappings create

“IM_SupportMessage_SYNC_OB_To_SendSMSToIndia_SYNC_IB” and select Source Interface as SupportMessage_SYNC_OB and target interface as SendSMSToIndia_SYNC_IB and request mapping as MM_SupportRequest_mt_To_SendSMSToIndiaSoapIn and response mapping as MM_SendSMSToIndiaSoapOut_To_SupportResponse_mt

2.2.3 Integration Directory

In the Integration Directory from the menu bar select Object-> New and create a scenario called

“INFY_HTML_TO_WebService” and save it.

Step1

Select Service Without Party-> Business Service. Right click create business services

HTML_Service and SMS_Service.

Step2

Configure the business services HTML_Service and SMS_Service with Receiver as

SendSMSToIndia_SYNC_IB and Sender as SupportMessage_SYNC_OB and save it. Under SMS_Service configure SOAP_RCV_SendSMS_001 communication channel.

No need to configure sender communication channel for HTTP adapter.

P.S: This is because HTTP and IDOC adapters are not part of SAP J2EE engine. They reside directly on SAP ABAP engine and part of ICF service. So no need to configure sender

Page 20: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

communication channel for these adapters. Also we don’t have to define any sender agreement for these adapters.

Step3 Configure SOAP_RCV_SendSMS_001 communication channel as

below;

20

Page 21: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 21

In the configure proxy option give proper host, port and username and password

Step4

Create receiver agreement with following parameters;

Sender

Service: HTML_Service

Receiver

Service: SMS_Service

Interface: SendSMSToIndia_SYNC_IB

Namespace: http://infosys.com/demo/SMSWebService

Receiver Communication Channel: SOAP_RCV_SendSMS_001

Step5

Create Interface Determination and use the below objects;

Sender

Service: HTML_Service

Interface: SupportMessage_SYNC_OB

Namespace: http://infosys.com/demo/HTML

Receiver

Service: SMS_Service

And select Inbound Interface SendSMSToIndia_SYNC_IB and Interface Mapping as

IM_SupportMessage_SYNC_OB_To_SendSMSToIndia_SYNC_IB.

Step6

Create Receiver Determination and use the below objects;

Sender

Service: HTML_Service

Interface: SupportMessage_SYNC_OB

Namespace: http://infosys.com/demo/HTML

Receiver

Party: *

Page 22: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 22

Service: *

And in Configured Receivers select service as SMS_Service. Save it.

2.2.4 Sender Service

Use the HTML client provided by SAP.

Give correct Sender Service, Sender Interface and Sender Namespace.

And XI username and password to connect to XI server. In the payload put this structure;

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

<? Xml version="1.0" encoding="UTF-8"?>

<ns:SupportRequest_mt xmlns:ns="http://infosys.com/demo/HTML">

<Header>

<ReceiptantMobileNumber>9845469318</ReceiptantMobileNumber>

<FromEmailAddress>[email protected]</FromEmailAddress>

</Header>

<BodyItem>

<Message>Hi, Please solve the issue. The server is down.Restart it./Message>

<DeliveryDate>25/10/2005</DeliveryDate>

</BodyItem>

</ns:SupportRequest_mt>

2.2.5 Receiver Service

Here the http://www.webservicex.net/SendSMS.asmx?op=SendSMSToIndia is the receiver business service. This will send SMS and will send the status response back to the sender service.

2.2.6 Unit Testing

For testing use the attached HTML client. The web service is already available in the Internet. In the HTML client give proper information and click send. SMS will be sent to the mobile no. provided and a response message will be displayed in the HTML client. The message flow can be monitored using transaction SXMB_MONI. If there is any error that can be resolved using the monitoring tool.

Page 23: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

3 FILE TO DATABASE USING BPM

3.1 Interface Landscape

In this scenario we will receive business data in flat files which needs to be uploaded into database using stored procedure. After uploading the stored proc will return back the status of the execution like the number of records update or inserted in the table. This status data will be written in a file.

Message Flow:

Flat File containing business data will be received in a particular directory.

XI polls that particular directory every 15 min.

Flat file structure is converted into database stored procedure structure.

Data is sent from XI to database using JDBC adapter where the Proc is executed.

After uploading or inserting data into table stored proc returns the status to XI.

This status is converted back to flat file structure and written in a particular directory called Status.

This is basically a Async-Sync communication. So we have to use BPM here to capture the data coming back from stored proc to XI and writing it to a file.

23

Page 24: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 24

3.2 Step by Step Approach for File to Database Scenario using BPM

To configure the File to Database scenario using BPM for the above requirement follow the following steps

3.2.1 System Landscape Directory

In the SLD create the following components in order.

Step 1

Under Software Catalog create software component FILE_WORKSHOP and DB_WORKSHOP and corresponding Products.

Step 2

Under Technical Landscape create technical systems FILE_DEV_TS and DB_DEV_TS based on the above software component and products.

Step 3

Under Business Landscape create two business systems;

FILE_DEV

DB_DEV

3.2.2 Integration Repository

In the Integration Repository (Designer) create the following objects.

Step1

From the menu bar, Tools -> Transfer from SLD-> Import software component versions

Select the software component ‘FILE_WORKSHOP’ and ‘DB_WORKSHOP’ and import it.

Step2

Under SC ‘FILE_WORKSHOP’ create namespace http://infosys.com/demo/DB_scenario and under SC ‘DB_WORKSHOP’ create http://infosys.com/demo/FILE_scenario .

Step3

Under http://infosys.com/demo/FILE_scenario namespace -> Interface Objects-> Data Types right click and create CustomerDetails_dt, DBStatus_dt

Under http://infosys.com/demo/DB_scenario namespace create DBCustomer_dt, DBCustomer_dt_response.

CustomerDetails_dt

Structure Category Type Occurrence CustomerDetails Complex Type 1:N CustomerID Element String 1:1 Name Element String 1:1 Address Element String 1:1

Page 25: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 25

HouseNo Element String 1:1 Street Element String 1:1 City Element String 1:1 PhoneNo Element String 1:1 QueryDetails Element String 1:1

DBCustomer_dt

Structure Category Type Occurrence Statement Element String 1:1 dbStmt Element String 1:N action Attribute String optional table Element String 1:1 CustomerID Element String 1:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional Name Element String 1:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional HouseNo Element String 1:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional Street Element String 1:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional City Element String 1:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional PhoneNo Element String 1:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional QueryDetails Element String 1:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional NoRowsInserted Element String 0:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional NoRowsUpdated Element String 0:1 isInput Attribute String optional isOutput Attribute String optional type Attribute String optional

Page 26: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 26

DBCustomer_dt_response

Structure Category Type Occurrence Statement_response Element 1:1 NoRowsInserted Element Integer 0:1 NoOfRowsUpdated Element Integer 0:1

DBStatus_dt

Structure Category Type Occurrence NumberOfRowsInserted Element Integer 0:1 NumberOfRowsUpdated Element Integer 0:1

Step4

Under Message Types right click and create message type CustomerDetails_mt, DBCustomer_mt, DBCustomer_mt_response and DBStatus_mt selecting the data types CustomerDetails_dt, DBCustomer_dt, DBCustomer_dt_response and DBStatus_dt respectively.

Step5

Under Message Interfaces right click and create message interfaces of following types;

Message Interface Message Types Attributes

CustomerDetails_Async_OB CustomerDetails_mt Async, Outbound

CustomerDetails_Async_ABS CustomerDetails_mt Async, Abstract

DBCustomer_Sync_IB DBCustomer_mt, Sync, Inbound

DBCustomer_mt_response

DBCustomer_Sync_ABS DBCustomer_mt, Sync, Abstract

DBCustomer_mt_response

DBCustomerProc_req_ABS DBCustomer_mt Async, Abstract

DBCustomerProc_res_ABS DBCustomer_mt_response Async, Abstract

DBStatus_Async_IB DBStatus_mt Async, Inbound

DBStatus_Async_ABS DBStatus_mt Async, Abstract

Step6

Under Mapping Objects-> Message Mappings right click and create

“MM_CustomerDetails_mt_To_DBCustomer_mt” (source as CustomerDetails_mt and target as DBCustomer_mt) and

“MM_DBCustomer_mt_response_To_DBStatus_mt” (source as DBCustomer_mt_response and target as DBStatus_mt).

Page 27: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 27

MM_CustomerDetails_mt_To_DBCustomer_mt

Source Message Type Element Target Message Type Element Functions to be used

Statement CustomerDetails dbStmt action Constant=EXECUTE table Constant = Give Stored

Procedure Name CustomerID CustomerID isInput Constant=TRUE isOutput type Constant=CHAR Name Name isInput Constant=TRUE isOutput type Constant=CHAR HouseNo HouseNo isInput Constant=TRUE isOutput type Constant=CHAR Street Street isInput Constant=TRUE isOutput type Constant=CHAR City City isInput Constant=TRUE isOutput type Constant=CHAR PhoneNo PhoneNo isInput Constant=TRUE isOutput type Constant=CHAR QueryDetails QueryDetails isInput Constant=TRUE isOutput type Constant=CHAR NoRowsInserted Constant=InsertCount isInput isOutput Constant=TRUE type Constant=NUMERIC NoRowsUpdated Constant=UpdateCount isInput isOutput Constant=TRUE type Constant=NUMERIC

MM_DBCustomer_mt_response_To_DBStatus_mt

Source Message Type Element Target Message Type Element Functions to be used

Statement_response NoRowsInserted NumberOfRowsInserted Count

Page 28: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

NoOfRowsUpdated NumberOfRowsUpdated Count

Select the correct context in order to get the correct count

Step7 Under Interface Mappings create

“IM_CustomerDetails_Async_ABS_TO_DBCustomerProc_req_ABS” and select Source Interface as CustomerDetails_Async_ABS and target interface as DBCustomerProc_req_ABS and request mapping as MM_CustomerDetails_mt_To_DBCustomer_mt.

“IM_DBCustomerProc_res_ABS_TO_DBStatus_Async_ABS” and select Source Interface as DBCustomerProc_res_ABS and target interface as DBStatus_Async_ABS and request mapping as MM_DBCustomer_mt_response_To_DBStatus_mt.

Step8

Under namespace http://infosys.com/demo/FILE_scenario create Integration Process “FILE_TO_STOREDPROC_BPM”. The BPM looks like

28

Page 29: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 29

First of all define the BPM flow and then configure it.

The steps in the above BPM are Receive, Transform, Send, Transform and Send. In the container area define variables as

Name Category Type

CustomerDetails Abstract CustomerDetails_Async_ABS

ProcReq Abstract DBCustomerProc_req_ABS

ProcRes Abstract DBCustomerProc_res_ABS

Status Abstract DBStatus_Async_ABS

Select the Receive step to configure it. In its properties area select Mode as Asynchronous, Tick the start process and Message as CustomerDetails.

In the Transform1 step for Interface mapping select IM_CustomerDetails_Async_ABS_TO_DBCustomerProc_req_ABS and Source Message as CustomerDetails and Target Message as ProcReq.

In the Send1 step select mode as Synchronous. In synchronous select DBCustomer_Sync_IB. Request message as DBCustomerProc_req_ABS, Response Message as DBCustomerProc_res_ABS.

In the Transform2 step for Interface mapping select IM_DBCustomerProc_res_ABS_TO_DBStatus_Async_ABS and Source Message as ProcRes and Target Message as Status.

In the Send2 step select mode as Asynchronous and message as Status.

3.2.3 Integration Directory

In the Integration Directory from the menu bar select Object-> New and create a scenario called

“INFY_FILE_TO_JDBC” and save it.

Step1

Select Service Without Party-> Business System. Right click and select business systems

FILE_DEV and DB_DEV.

Step2

Under Integration Process right click. This will launch a wizard in which select the BPM FILE_TO_STOREDPROC_BPM. Give the name FILE_TO_STOREDPROC_BPM and click finish.

Step3

Under business system FILE_DEV create a communication called “FILE_SND_CRM_001” and “FILE_RCV_STATUS_CRM_001” and under DB_DEV create “JDBC_RCV_CRM_001”.

Step4 Configure FILE_SND_CRM_001 as below;

Page 30: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

30

Page 31: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

FILE_RCV_STATUS_CRM_001

31

Page 32: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

Step5

Configure JDBC_RCV_CRM_001 as below;

Step6

Create sender agreement with following parameters;

Sender

Service: FILE_DEV

Interface: CustomerDetails_Async_OB

32

Page 33: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 33

Namespace: http://infosys.com/demo/FILE_scenario

Receiver

Service: FILE_TO_STOREDPROC_BPM

Sender Communication Channel: FILE_SND_CRM_001

We have to create two receiver agreements. One for JDBC adapter and other for FILE adapter used for creating status file.

Create receiver agreement with following parameters;

Sender

Service: FILE_TO_STOREDPROC_BPM

Receiver

Service: DB_DEV

Interface: DBCustomer_Sync_IB

Namespace: http://infosys.com/demo/DB_scenario

Receiver Communication Channel: JDBC_RCV_CRM_001

Create receiver agreement with following parameters;

Sender

Service: FILE_TO_STOREDPROC_BPM

Receiver

Service: FILE_DEV

Interface: DBStatus_Async_IB

Namespace: http://infosys.com/demo/FILE_scenario

Receiver Communication Channel: FILE_RCV_STATUS_CRM_001

Step7

In this case we will have three interface determinations.

> Create Interface Determination and use the below objects;

Sender

Service: FILE_DEV

Interface: CustomerDetails_Async_OB

Namespace: http://infosys.com/demo/FILE_scenario

Page 34: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 34

Receiver

Service: DB_DEV

Select Inbound as Interface CustomerDetails_Async_ABS and there will be no Interface Mapping.

>Create Interface Determination and use the below objects;

Sender

Service: FILE_TO_STOREDPROC_BPM

Interface: DBCustomer_Sync_ABS

Namespace: http://infosys.com/demo/FILE_scenario

Receiver

Service: DB_DEV

Select Inbound Interface as DBCustomer_Sync_IB and there will be no Interface Mapping.

>Create Interface Determination and use the below objects;

Sender

Service: FILE_TO_STOREDPROC_BPM

Interface: DBStatus_Async_ABS

Namespace: http://infosys.com/demo/FILE_scenario

Receiver

Service: FILE_DEV

Select Inbound Interface as DBStatus_Async_IB and there will be no Interface Mapping.

Step8

We have to create three Receiver Determinations.

>Create Receiver Determination and use the below objects;

Sender

Service: FILE_DEV

Interface: CustomerDetails_Async_OB

Namespace: http://infosys.com/demo/FILE_scenario

Receiver

Party: *

Page 35: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 35

Service: *

Select service as FILE_TO_STOREDPROC_BPM in Configured Receivers. Save it.

>Create Receiver Determination and use the below objects;

Sender

Service: FILE_TO_STOREDPROC_BPM

Interface: DBCustomer_Sync_ABS

Namespace: http://infosys.com/demo/FILE_scenario

Receiver

Party: *

Service: *

Select service as DB_DEV in Configured Receivers. Save it.

>Create Receiver Determination and use the below objects;

Sender

Service: FILE_TO_STOREDPROC_BPM

Interface: DBStatus_Async_ABS

Namespace: http://infosys.com/demo/FILE_scenario

Receiver

Party: *

Service: *

Select service as FILE_DEV in Configured Receivers. Save it.

3.2.4 Unit Testing

For testing we need to have access to a shared directory where we will receive input files. Also in the shared file system the processed files will be archived and the status file will be created.

We have to create a table having columns “CustomerID, Name, HouseNo, Street, City,

Page 36: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 36

PhoneNo, QueryDetails”. Also have to create a stored procedure which will insert or update

Into this able and will return the count of number of records inserted and updated.

Sample Stored Procedure:

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_NULLS ON

GO

ALTER PROCEDURE [CustomerProc] (

@CustomerID [char](30),

@Name [char](30),

@HouseNo [char](30),

@Street [char](30),

@City [char](30),

@PhoneNo [char](10),

@QueryDetails [char](100)

@NoRowsInserted [numeric](4) OUTPUT ,

@NoRowsUpdated [numeric](4) OUTPUT

)

AS If (Select CustomerID from CustomerDetails where CustomerID=@CustomerID) IS NULL

BEGIN

INSERT INTO [Northwind].[dbo].[CustomerDetails]

([CustomerID],

[Name],

[HouseNo],

[Street],

[City],

[PhoneNo]

[QueryDetails])

Page 37: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 37

VALUES

(@CustomerID,

@Name,

@HouseNo,

@Street,

@City,

@PhoneNo

@QueryDetails)

Select @ NoRowsInserted = @@ROWCOUNT

END

ELSE

BEGIN

UPDATE [Northwind].[dbo].[CustomerDetails]

SET

[CustomerID]=@CustomerID,

[Name]=@CustomerName,

[HouseNo]=@HouseNo,

[Street]=@Street,

[City]=@City,

[QueryDetails]=@ QueryDetails WHERE [CustomerID]=@CustomerID

Select @ NoRowsUpdated = @@ROWCOUNT

END

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO

NOTE:-The above scenario can be modified a little bit using action as “UPDATE_INSERT”. In this case we don’t have to use stored procedure. If the records are present in the table then this will be updated or it will be

Page 38: SDN Community Contribution · 2019-11-12 · system using XI. The communication between TIBCO and XI is though Web Service call. So XI exposes an interface as a Web service which

Step-By-Step Approach for Implementing XI Scenarios

© 2005 SAP AG The SAP Developer Network: http://sdn.sap.com

inserted. In response we will get the number of records inserted or updated which we will map to the status file structure. So in the above scenario use the below mentioned target request and response structure. Everything else will remain as usual and we don’t have to use stored proc.

DBCustomer_dt

Structure Category Type Occurrence root Element Statement Element 1:1 dbTable Element 1:1 action Attribute String required table Element String 1:1 access Element 1:N CustomerID Element String 1:1 Name Element String 1:1 HouseNo Element String 1:1 Street Element String 1:1 City Element String 1:1 PhoneNo Element String 1:1 QueryDetails Element String 1:1 Key Element 1:N CustomerID Element String 1:1

During mapping in action use constant=UPDATE_INSERT, in table give the table name.

The response from the database will look like

DBCustomer_dt_response

Structure Category Type Occurrence root_response Element 1:1 update_count Element Integer 0:1 insert_count Element Integer 0:1

Author Bio

Mukeshlal Parida is a certified SAP XI and webMethods Development Consultant at Infosys Technologies Limited, India. He is a part of the SAP XI frameworks definition guild in Infosys and has greatly contributed to design, development, training, client consultation and other technical frameworks design. His areas of expertise include EAI Solution Development in SAP XI, TIBCO, Mercator, SeeBeyond, webMethods and J2EE.

38