Skip to Content
0

One Sender, two receivers: 1 passthrough, 1 mapping

Sep 15, 2017 at 11:52 AM

134

avatar image

Hi there,

Scenario:

Single message routed to:

a) file - passthrough without mapping

b) receiver (R/3) - mapping

Message is an email attachment - might be XML or PDF (distinguishable by FileName attribute delivered by splitter module). XML schema is known.

Using dummy interfaces, I was able to resolve passing data to file.

But I am left with dummy sender interface.

Is it possible to add another receiver in iFlow to achieve the following ?

- if FileName is *XML

- assume message is not DUMMY but based on XML schema

- perform mapping

- deliver to r/3

I believe I could do it in two steps: create another scenario in which previously stored file would be processed further, but I'd like to stay with 1 scenario if possible.

Thanks,

Bart

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

6 Answers

Best Answer
Evgeniy Kolmakov Sep 19, 2017 at 09:59 AM
0

Hi Bartosz!

I would create outbound interface with XML message type. Since you choose receiver according to FileName, it doesn't matter if non-XML payload comes to Receiver determination. Thus, in first case you just set receiver interface (even dummy) and receiver communication channel for that interface and in second - you will be able to select appropriate Operation mapping for your source interface/XML message type.

Regards, Evgeniy.

Show 10 Share
10 |10000 characters needed characters left characters exceeded

I am not following.

Are You saying, that message validation (outbound message) is done at receiver determination step ?

This way I can create service interface with XML message type, feed it with XML and PDF data, and depending on receiver I could pass both as dummy (and save to files) and additionaly one as XML via SOAP together with mapping ?

0

What do you mean saying "message validation"? If you're talking about validation against XSD Scheme in adapter - I guess you don't use it because in this case you wouldn't be able to send both xml and non-xml messages.

Messaging system itself doesn't perform any validations. It evaluates condition expression, if any, at Receiver determination step and passes the payload "as is" to Operation mapping. If you use message mapping, input payload is parsed according to source message type structure. If you use java or XSLT, you apply the transformation logic yourself.

Regards, Evgeniy.

0

Right now, what have is:

1. SOAP -> Dummy outbound service interface -> Dummy inbound service interface -> File

What I tried:

1. All payload: SOAP -> Dummy outbound interface -> Dummy inbound service interface -> File

2. XML payload: SOAP -> Dummy outbound interface -> Specific inbound service interface (with mapping)-> File (*)

(*) - here I couldn't create mapping, because outbound interface is dummy and there is no way to do mapping.

Now, let's assume the following:

1. All payload: SOAP -> Specific outbound interface based on XSD (**) -> Dummy inbound service interface -> File

2. XML payload: SOAP -> Specific outbound interface based on XSD -> mapping -> Specific inbound interface -> R/3

(**) - by validation I meant checking incoming message against XSD.

Will the incoming payload be validated against XSD in step 1 ?

If I understand You correctly, it will not be validated unless operation mapping is involved and mapping is provided only in step 2 ?

0

Hi Bartosz!

What exactly is the FileName attribute in your case? Is it Dynamic Configuration attribute?

Regards, Evgeniy.

0

It's a Context Object - works fine with File adapter.

Tried to use outbound service interface based on XSD schema, and it died on PDF payload:

Transmitting the message to endpoint using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.aii.adapter.xi.routing.RoutingException: Unable to parse XML message payload to extract operation for receiver determinationorg.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

Not sure, why it needs payload to use context object in determination.

0

Ok, in this case you could use Extended Receiver determination.

Regards, Evgeniy.

0

Will have to read the docs, never done that before.

Will report progress.

Thanks, Bart

0

Just a very simple java mapping to read DC attribute "FileName" and set Receiver according to that.

0

Something like this:

public class ED_GetReceiver extends AbstractTransformation {

@Override
public void transform(TransformationInput in, TransformationOutput out)throws StreamTransformationException {
try {
DynamicConfiguration dc = in.getDynamicConfiguration();
DynamicConfigurationKey fileKey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String srcFileName = dc.get(fileKey).trim();

String outMsg = "<ns1:Receivers xmlns:ns1=\"http://sap.com/xi/XI/System\"><Receiver><Service>" + 
(srcFileName.endsWith(".pdf") ? "BS_FOR_PDF" : "BS_FOR_XML") + "</Service></Receiver></ns1:Receivers>";

out.getOutputPayload().getOutputStream().write(outMsg.getBytes("UTF-8"));
}
catch (Exception e) {
throw new StreamTransformationException(e.getMessage());
}
}
}

Regards, Evgeniy.

0

"Will report progress"... right.

Well, better late than never.

Thanks for suggestions and java code.

Java receiver determination worked in a separate test flow, just to check if it generally works.

Had other issues which stopped me from a fully working solution - used external component for extracting attachments and creating separate messages from them. In this flow it just didn't work. Started getting pending messages, which were not delivered at all. Eventually gave up, went with SOAP -> File. File -> R/3

0
avatar image
Former Member Sep 15, 2017 at 12:27 PM
0

Hi,

Yes you can achieve this using put the condition at Interface or receiver determination step in ICO

Regards

GAgan

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Sep 15, 2017 at 02:42 PM
0

Hi Bartozs!

In general I 'm agree with Gagandeep, but you can face some issues.

Your receiver determination can raise exception in case of non-XML payload. In this case you should apply SAP Note 1354905.

In receiver determinaton you use condition for receiver in case of XML payload and default receiver for cases when condition is not true (for non-XML payloads). You set the rule to use default receiver when no condition matches your source data.

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
Bartosz Bijak Sep 18, 2017 at 01:43 PM
0

Added another communication component in the ICO-Receiver tab.

Set condition: "FileName CP *.xml"

Moved to ICO-Receiver interfaces tab, selected newly added receiver, but I can't pick any inbound service interfaces.

Inbound service is currently used in another flow and it does work in that setup.

Why can't I pick up any inbound interfaces from newly added receiver ?

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Sep 18, 2017 at 02:45 PM
0

Hi Bartosz!

If you've used Business Component as receiver, did you assign any inbound interfaces for it?

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
Bartosz Bijak Sep 19, 2017 at 09:02 AM
0

I wasn't able to pick any interface up because I've configured technical system as Standalone and couldn't assign Software Component to it.

Changed that, now I can see values.

But... another issue...

My outbound interface is dummy, as I do not know the structure of XML data.

To add another receiver for XML with known structure I need to create operation mapping.

The point is I am not able to create OM for a dummy service interface and thus add mapping in receiver determination.

Share
10 |10000 characters needed characters left characters exceeded