cancel
Showing results for 
Search instead for 
Did you mean: 

Wrting a file from inside an adapter module

HimanshuB
Associate
Associate
0 Kudos

Hi All,

We have a scenario in our project where a sender system sends a mail attachment. This attachment contains either an EDI message or a print file (binary data which needs to be printed later on).

There is a indicator in the message body to identify the type of message (EDI or print file).

We have decided to use an Adapter Module where we will perform following steps

1. Read the indicator to identify the message type

2. If print file , save it into some local/remote directory (path could be provided as a module parameter) and end the processing (or create some dummy message for monitoring purpose).

3. If it is an EDI message , we need to call some service to convert it into the XML format and pass on to the Integration engine for further processing.

My problem lies in step 2 , for writing the file I have two options :

a. Use Java APIs (this could have reliability issue like how to handle connection failure in this case?)

b. Configure a receiver File adapter and somehow call it from inside the adapter module (is it possible?)

If anyone of you have come across similar situation, please guide me how to handle it in the best possible way.

Thanks & Regards,

Himanshu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

could you not use satndard fucntioanlity and the extended receiver determination to provide the end location for the information dependant on this field?

Answers (1)

Answers (1)

former_member190389
Active Contributor
0 Kudos

what you can do is when the type is print file just send the input file as it is as the o/p of the module then use this the type in the structure to perform receiver determination and do the routing to the file adapter.

HimanshuB
Associate
Associate
0 Kudos

If I have understood correctly, you mean to suggest that adapter module will return a common message payload like

<MT_COMMON>

<PRNT_IND>1 </PRNT_IND>

</MT_COMMON>

And will keep the original attachments as well.

Then use conditional receiver determination

1. If PRNT_IND = 1 then send it to the file adapter ( maybe I can use the swap bean to write only the attachment part?)

2. If PRNT_IND = 2 , The attachment in this case (EDI message) is still in text format and I need to call some external service (itu2019s deployed in a different runtime environment outside WAS and I have Java APIs available to call these services) to convert it into required XML message for further mapping inside XI. What do you suggest I should do for this? As I have not much experience hadnling the attachments i am not sure if we can process attachments through java mappings?

Regards,

Himanshu

former_member190389
Active Contributor
0 Kudos

Yes you are absolutely right friend..

former_member190389
Active Contributor
0 Kudos

But for the second condition if you want to make a call to your service you can do it itself in the module and return the o/p of that service to the common format with indicator set to 2.

You cannot access the attachments in java mappings.

Edited by: Progirl Progirl on Jul 17, 2008 2:45 PM

Edited by: Progirl Progirl on Jul 17, 2008 2:47 PM

HimanshuB
Associate
Associate
0 Kudos

So the adapter module will output something like this

<MT_COMMON>

<PRNT_IND>1 </PRNT_IND>

<EXT_STRUCTURE>

.

.

.

</EXT_STRUCTURE>

</MT_COMMON>

There are a few existing mappings based on the structure returned by the conversion service and this is a huge structure to be mapped.

But thatu2019s not much of the problem and to avoid disturbing any existing mappings we can add another mapping from <MT_COMMON> to <EXT_STRUCTURE> in the mapping chain.

This sounds good enough and I have awarded the points as well

However, it clearly increases the effort and requires adding a whole lot of new objects/configuration.

I would still like to know if there is a way to access/lookup another communication channel from inside the Adapter Module as we can do from a UDF or java mapping? This will help restricting all the complexity to a single point.

Regards,

Himanshu

former_member190389
Active Contributor
0 Kudos

Yes you can access the comm channel ...if i am not wrong.. please look at the

link

http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/lookup/LookupService.html

HimanshuB
Associate
Associate
0 Kudos

As this blog suggests [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5084] [original link is broken] [original link is broken] [original link is broken];

mapping lookup service doesn't seem to work in case of Adapter modules 😐

former_member190389
Active Contributor
0 Kudos

Class LookupService.Internal

this class provides a method to register it but ..there it is written Do not use ; For Internal XI use only