since the other operation, that write output into attachement is marked as nearly deprecated on the documentation...
Actually, there is a third operation, that replaces the depreciated one (transformToMTomAttachment).
The third step is handled by a POJO, because I didn't find any standard component to handle this (on the other hand, I didn't find a way to this with a POJO neither). If any exists, I am realy willing to use it
The POJO is fine for such a case.
Try exchange.getInMessageAsDocument() to get the input message as a document.
EDIT: I checked again: actually, I made a mistake. I have this operation in the helper, I just thought this was the one that was deprecated. I think I will use this operation then, since it seems to do the trick I want. If you have some time to answer, I am still interested in a POJO styled solution.
It depends on the way you want to return the attachment.
The simple solution is to create a data handler (take a look at the Talend SE in the Petals source code for an example) and to attach it to the exchange.
For a better solution, you should use a MTOM attachment.
It means there is an attachment and that this attachment is referenced in the XML payload. There are utilities in the CDK to do it. Or you can take a handy approach (once again, take a look at the Talend SE, the abstract processor how to add MTOM attachments on Petals messages).