cancel
Showing results for 
Search instead for 
Did you mean: 

Handling attachments in XI

0 Kudos

Hi All,

I am working on a scenario where in I recieve the Payload from a web service.The payload consists of 2 parts one is the xml document and the second is the attachment (image,PDF,..).When I monitor the messages in sxmb_moni I find 2 payloads as shown below.

Payloads 
             attachment-1 ( image/jpeg ) 
              MainDocument ( text/xml;charset=utf-8 )

I have a file server on the reciever side and I want 2 files to be created on the target side i.e., one the xml file and the second the attachment.

Can anyone help me how can I handle the 2 payloads either in mapping or during configuration.

Is it possible to handle the attachments in mapping(XSLT or Java) and how?

Thanks in advance.

Vikram

View Entire Topic
stefan_grube
Active Contributor
0 Kudos

The SOAP Axis receiver adapter can handle multiple file attachments.

You cannot map the attachment in 3.0/7.0 (you can in 7.1), you can only map the main document.

Regards

Stefan

0 Kudos

Thank you.

But what is the way to parse the attachment to the target location which is a file server.

stefan_grube
Active Contributor
0 Kudos

Could you explain why you want to parse the attachment, which is a picture in your example?

0 Kudos

The attachment here may not be only a image it can be even a PDF file or a word document.These attachments (image or a PDF) is some how related to the data contained in the main document.

Former Member
0 Kudos

Hi Vikram,

I believe you can achieve this requirement by using Java mapping and Multi-Mapping techniques.

1. Create 2 target Message Types a] Message type for Original payload (for Eg. MsgType1) b] Message type for Binary Attachment data (for Eg. MsgType2)

2. In Interface mapping include 2 target messages MsgType1 and MsgType2

3. Make MsgType1 occurrence as 1 and MsgType2 occurrence as 0 to Unbounded

4. Write a Java mapping to generate the Multi-Mapping payload with one Message for MsgType1 and 0 or more messages for MsgType2.

5. Java mapping program has to utilize Message interface functions

getAttachmentIterator()
from
com.sap.engine.interfaces.messaging.api.Message
and generate the Binary payload for MsgType2.

6. Configure one file adapter for main payload (MsgType2) and one more for Binary payload (MsgType2)

Hope this helps.

Regards,

Ananth

0 Kudos

Thank you Ananth.

This is what I have done in my scenario.I have used 2 msg types and used multimapping to map the main document and the attachment saperately.I am struck up while writing java code for implementing java mapping to split the payload into 2 parts and map it accordingly.

Can you help me writing the java code to implement this.

Thanks in advance,

Vikram

Former Member
0 Kudos

Hi,

I think Stefen Grube is correct. Looks like we can't solve your problem using Java mapping if you are in XI 3.0 / PI 7.0 because you can't access payload attachments from mapping programs. But PI 7.1 has new set of API's which enables you to access the payload attachments from Mapping programs..[PI 7.1 Java Mapping API -InputAttachments- Contains methods to read the attachments of the XI message in the mapping|https://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/InputAttachments.html]

Regards,

Ananth

Edited by: Ananth Chinnaraj on Jul 17, 2008 2:45 AM