SAP XI/PI/PO how to handle sync to async Interfaces
Hi all
sometimes it is not given to discuss with Sender and Receiver about a good Interface architecture. We all know the wonderful sentence: Sender and Receiver Interface can not be modified so please PI developer do the needful 🙂
Also with AEX single stack we can not use ccBPM and will avoid to use BPM for such a technical stuff.
Below you will see different solutions which can help you to find your specific way.
There are multiple ways how to do this
– with UDF
– with SAP Standard BEANs
– with Transform Function in Response Mapping
Dear Daniel,
nice contribution!
Please find a blog explaining the bean approach here already (believe it or not I also got positive feedback from former SAP colleagues although the comment of the blog is not very positive): https://blogs.sap.com/2015/10/08/sync-async-soap2idoc-with-sap-pro-wout-bpm .
However, I would not recommend any of the other approaches.
A UDF to perform a Lookup is not meant to be sending asynchronous messages. It is not a good design.
Handling the empty response with a Java Mapping (which is basically what you do using the transform method) is quite nice, however you are loosing the source message and would have to pass over some values via adapter modules if necessary...
Best regards,
Adam
Hi Adam
I totally agree with you that not each approach will be wonderful.
As I wrote, this is only a way to solve problems if the whole Interface design between Sender and Receiver has bad design J
In case of keep values from input massage, in the runtime for final response in the OperationMapping, you can use Container or the DynConf:
UDF Quelltext Set
public String setDynConf(String namespace, String key, String value, Container container) throws StreamTransformationException{
DynamicConfiguration dc = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey dck = DynamicConfigurationKey.create(namespace, key);
dc.put(dck, value);
return "";
}
UDF Quelltext Get
public String getDynConf(String namespace, String key, Container container) throws StreamTransformationException{
DynamicConfiguration dc = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey dck = DynamicConfigurationKey.create(namespace, key);
String value = dc.get(dck);
return value;
}
BR
Daniel
My approach with this Blog is to have all opportunities for such “bridges” in one blog so it is wonderful that you have shared your Link here J
Hello.
I'm trying to implement the first scenario (Sync - Async) without BPM
In the image with the title "Sync to Asy Interface with Transform" i'm seeing a Message Mapping in which i need to insert code into the function called "Attributes an Methods".
I did it, but when i tried the service into the log of the request i see an error because the answer of the async web service is null.
1- What type of source message and result message are you implementing for the Message Mapping?
2-How you controll the null response of the async web service?
I hope you can help me
Thanks and regards.
Hi
Sorry for delay.
You need following mappings:
One ist the request. This is your inputStructure from Sender to the HTTP-Request-Structure of Receiver.
The first ResponseMapping is the one with the transform function. (This means that the graphical field mapping is not really used in this step)
The function creates a XML-structure like you define it in targetxml.
targetxml = "<request><doc><BusinessSystem>NoResponseButCallWasOK</BusinessSystem></doc></request>";
You should create a DataType and MessageType with exactly this format you set in function: <request><doc><BusinessSystem>.
Use this for source and target in this first ResponseMessageMapping.
If you need to create a final structure for your Sender as response you need a second ResponseMapping.
Source is the MessageType from first Response mapping and target is the final ResponseStructure of your SenderSystem.
Daniel