Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
Image a scenario in witch the the sender system sends two files filenameHEADER.TXT
filename.ZIP
The first file is the master file, it contains header data .
The second file (filename.ZIP) will be treated as an attachment (for example in case of file to mail scenarios).
This means that in the SOAP XI Message we will see two payloads: MainDocument and the our attachment.

The File Sender Communicational Channel is configured in this way:

image

In this way everything works fine. In SXMB_MONI we can see that we have the payload that contains our email address, and the attachment (%F) that is our zip file.



At this point we want to change the name and the mime type of the attachment we want to give the same name of our real .ZIP file.

I’ve not found a way to do that with standard SAP modules such as PayloadSwapBean and MessageTransformationBean, so I decided to write my own module.

The RenameAttachmentModule accepts the following parameters:

- Param.AttachmentName: that is the name of the attachment that must be changed. (REQUIRED)
  Possible values:
     - any attachment name present in the XI Message.
- Param.NewAttachmentName : is the new mime type we want to assign to the attachment. (OPTIONAL)
  Possible values:
     - %f -> can be used only for file/FTP adapter, and is the File Name picked up by the communicational channel.
     - any other string.
- Param.NewAttachmentExtension is se to the extension we want to add to the new file name. (OPTIONAL)
  Possible values:
     - any string.
- Param.NewAttachmentMimeType: is the new mime type we want to assign to the attachment. (OPTIONAL)
  Possible values:
     - possible mime type.
- Param.NewAttachmentNameReplace this paramenter work in the same way of the namePart parameter in Additional file
configuration of the File Adapter.
   This parameter must be used only in case of Param.NewAttachmentName is %f and only in File Adapter. (OPTIONAL)



The result is that we now have the attachment with the desired name and mime type.




Here the code of the adapter module:



References
How To Create Modules for the J2EE Adapter Engine
Example Adapter and Example Module
6 Comments