File Record Confirmation in a NW PO Scenario
Objective
SAP introduced with the NetWeaver Process Orchestration platform a paradigm shift from PI double stack to AEX Java only. The new approach required a replacement of former ccBPM because its runtime was implemented in PI ABAP stack. Instead NetWeaver BPM took responsibility for process management tasks.
Asynchronous Messaging
Asynchronous message processing is generally preferable compare to synchronous. Asynchronous messages can be queued, time-delayed delivered, reprocessed and do not cause performance problems. A serious disadvantage is the missing control about the success of delivery. Acknowledgments are the web standard to circumvent this lack. These are asynchronous confirmation messages which give back information regarding the delivery or success of the original message.
Acknowledgments in NW BPM
NW BPM does not support acknowledgments like ccBPM did, at least not in release 7.31. Please have a look to the discussion BPM Design for Workaround missing Support for Acknowledgments. The objective of this document is to show up a way to circumvent this missing feature and to illustrate how to get a confirmation about the delivery of a File Communication Channel back to a NW BPM instance.
Please notice that this work around is ONLY for NW BPM confirmations, in a “normal” PI flow acknowledgments can be requested as usual. For example an asynchronous scenario ABAP proxy -> PI -> File without use of BPM can use acknowledgments like in former PI versions.
Acknowledgments in ccBPM
To understand the challenge it can be helpful to have short look to Michal’s blog XI: Playing with the file adapter’s acknowledgments
Picture from that blog:
A ccBPM send step requests a transport acknowledgment. In case of negative acknowledgment an exception branch is executed. In addition a deadline branch will jump into exception status in case no acknowledgment is coming at all. This design will guarantee a success/error message for any case.
Message Flow in a NW PO Scenario
- A web client sends an order via PI to BPM.
- BPM sends a message via PI to the file system. The order is written as xml file.
- The xml file will be read again by a PI file adapter and sent to BPM. It will be correlated to the original message by use of file name. All BPM interfaces need therefore an extra field in their order data type containing the file name.
- In case of a successful correlation a corresponding notification will be sent via PI to a mail receiver, otherwise an error message.
Implementation in PI
Enterprise Service Repository
Data types (3) for order, order+filename (one additional field for file name), mail package Configuring the Mail Receiver Adapter)
Message types (3) for order, order+filename, mail package (xml namespace http://sap.com/xi/XI/Mail/30)
Interfaces (8)
Interface | Message Type | Notes |
---|---|---|
OrderFromClient_Async_Out |
order | |
OrderFromClient_Async_In | order+filename | BPM inbound interfaces need pattern “Stateless (XI30-Compatible)” |
OrderToFile_Async_Out | order+filename | |
OrderToFile_Async_In | order | |
OrderFromFile_Async_Out | order | |
OrderFromFile_Async_In | order+filename | BPM inbound interfaces need pattern “Stateless (XI30-Compatible)” |
Confirmation_Async_Out | order+filename | |
Confirmation_Async_In | mail package |
Mappings (4)
OrderFromClient_to_OrderFromClient: File name is created dynamically by concatenation of constants, the order number and a timestamp
OrderToFile_to_OrderToFile: The user defined function “setFileName” is executed to the target root node.
UDF: ————————–
String orderFileName;
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/File”,”FileName“);
conf.put(key,fileName); return “”;
———————————-
OrderFromFile_to_OrderFromFile: The user defined function “ReadFileName” does not have input parameter. Its maps a dynamic configuration header field to the field file name. The try and catch is useful to test the mapping in design time.
UDF: ————————–
String orderFileName;
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
try {
DynamicConfigurationKey key = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/File”,”FileName“);
orderFileName = conf.get(key);}
catch (Exception e){
orderFileName=”OnlyMappingRuntime”;}
return orderFileName;
———————————-
OrderConfirmation_to_MailConfirmation: The mail package content and subject is created dynamically. Standard function “exist” checks if field filename is available; dependent from that an error text / subject or a success text / subject will be created.
Configuration
Business System Web Client:
– 1 standard SOAP sender channel
Business System File System:
– A ftp receiver channel writing files to a temporary folder. In the Advances tab “Use AdapterSpecific-Message Attributes” and “File Name” is checked on to determine the filename from ASMA header.
– A ftp sender channel reading the file from temporary folder and archiving to final folder. Here as well “Use AdapterSpecific-Message Attributes” and “File Name” is checked on.
Business System Mail Receiver:
– 1 standard mail receiver channel using mail package (message protocol “XIPAYLOAD”
Business Service for BPM process:
Should be a Business Service without SLD entry, because the identity is same in production and test environment. To be able to test indepent from BPM each channel should be created twice: One with message protocol “SOAP1.1”, another with message protocol “XI 3.0”. Target URL is for each channel: http://localhost:50000/MessagingSystem/receive/JPR/XI
– 1 soap sender channel with SOAP1.1 protocol for local test without bpm
– 1 soap receiver channel with SOAP1.1 protocol for local test without bpm
– 1 soap sender channel with XI 3.0 protocol for traffic with bpm
– 1 soap receiver channel with XI 3.0 protocol for traffic with bpm
4 Integrated Configurations
Local Test without BPM
First the Integrated Configurations should be created with SOAP1.1-channels. Each single flow should be tested (e.g. with SOAP UI). After finishing that test the SOAP1.1-channels can be replaced by the XI 3.0-channels.
SAP NetWeaver Developer Studio
Preparation
Just a few points should be outlined because NW BPM is relativly new and development in NWDS is not so common.
Support package no of BPM runtime must match with SP of NWDS. In addition the JDK version (first two digits).
Screenshot from NW Administration
Screenshot from EHP1 for SAP NetWeaver Developer Studio 7.3
Implementation
Screenshot from NWDS Process Design.
The main focus of this work around is not a introduction to NW BPM. For very new beginners i recommend to study William Li’s document: NetWeaver BPM for System-to-System Message Orchestration (Including Migration of ccBPM to NW BPM).
First step is to create a new Product / Software Component / Process in the perspective “Composite Designer”.
Interface Import
ESR has to be linked: Preferences/Web Services/Enterprise Service Browser
Import:
- OrderFromClient_Async_In: Create a dummy Reference and delete it later under “Service Groups”
- OrderToFile_Async_Out: Create a Reference with Type XI, put process name (of PI Configuration) as “Sender Component”
- OrderFromFile_Async_In: Create a dummy Reference and delete it later under “Service Groups”
- Confirmation_Async_Out: Create a Reference with Type XI, put process name (of PI Configuration) as “Sender Component”
Data Objects
- orderFromFile: drag and drop of data type “order+filename” into the modeler
- orderFromClient: drag and drop of data type “order+filename” into the modeler
Receive fr Client
- Starting Point
- Event Trigger: New Message Trigger with reference to “orderFromClient_Async_In”
- Mapping: Message type order+filename -> orderFromClient
Send to File
- Automated Activity
- Interface: OrderToFileAsync_Out
- Mapping: OrderFromClient -> Message Type order+filename
Split parallel
- Parallel Split
Receive from file
- Intermediate Message
- Event Trigger: New Message Trigger with reference to “orderFromFile_Asyn_In”
- Mapping: Message Type order+filename -> orderFromFile
- Correlation Condition: string-equal(<drag&drop Local/order+filename/filename from “Context”>,<drag&drop Global/orderFromClient/filename from “Context”>)
Wait for Confirmation
- Intermediate Timer
- Timer Configuration: Offset: 90 sec
Send Success Mail
- Automated Activity
- Interface: Confirmation_Async_Out
- Mapping: ordersFromClient -> Message Type order+filename
Send Error Mail
- Automated Activity
- Interface: Confirmation_Async_Out
- Mapping of order structure: ordersFromClient/order structure -> Message Type order+filename / order structure
- Mapping of filename: orderFromFile/filename -> Message Type order+filename/filename (this will lead to a missing field filename – the PI mapping reacts corresponding to that)
Succ Terminate
- Termination (will stop both branches of a parallel split)
Error Terminate
- Termination (will stop both branches of a parallel split)
Please don’t hesitate to comment the blog. Any kind of suggestions, contributions, ideas of improvement or requests for modifications are appreciated.
Thank you Udo for sharing this blog,definetly usefull .
Great blog Udo, very well documented 🙂
Great summarized. Thank you
Question 🙂
If i understood this correctly, are you trying to read the same file that you created and correlate the file name to mock and acknowledgement?
if so, does this mean there is one adapter constantly reading a file (that was created) and that we dont need to process? What is the behavior if the running BPM process completes (on a successful acknowledgement) and the adapter continues to poll this file?
have i been able to articulate my query in the right way? 😕
Hi Shabarish,
to your first question: yes
to the second: no, the file is written to a temporary folder and archived (by reading) to a final folder -> the adapter will poll only once (see as well chapter "Configuration").
/Udo
Hi Udo,
I think you can get around this with a simple "trick".
Build a synchronous interface for your file transfer, as far as i saw if you invoke the adapter in synchronous mode, it'll give you back an "empty" message if successful or an error if an error occurs.
However this should be enough for the caller (here BPM) to get the confirmation if the write was successful or not 😉
Of course you need to construct a "fake" response message from the empty response (e.g. with an xsl) to satisfy your caller process.
Cheers
Sebastian
Hi Sebastian,
That could be right.
Just for curiousity, I have one question...
But my recent scenario, where I called sender soap axis adapter in EO QoS and I was able to replace empty response(not sure if it was coming ...) or NULL response with the custom message using custom handler in sender axis channel.
Wondering if using EO QoS can also get response back- either null or empty..
@Udo Martens: As usual.. liked your blogs... I will try to implement similar scenario...to walk the talk... 🙂
--Divyesh