on 09-02-2016 1:36 PM
Dear All,
I have a requirement where I am sending xml payload and multiple attachments from SAP to 3rd Party system.
For each attachment , I have to fetch Content-Transfer-Encoding and pass this in a field in receiver side.
Anyone please give me an idea how to do this requirement ???
Any UDF or java could would be a great
Thanks
Sandeep
Hi S. Sharma!
I've never tried it myself but within adapter module you can try to get attachment as Payload and use its method getAttribute().
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am using this UDF to fetch other attributes of attachment but I dont know whats the method to fetch content transfer encoding.. Please suggest.
String attachmentID = null;
java.util.Map map;
AbstractTrace trace;
//gets the input attachment from the source message
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
trace = container.getTrace();
//map = globalContainer.getParameters();
try
{
//checks for the availability of attachments in the input message
if(inputAttachments.areAttachmentsAvailable())
{
trace.addInfo("Attachments Available");
//gets the attachmentIds and store it in an Object array
Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);
Object[] arrayObj = CollectionIDs.toArray();
//Loops at the input attachments to get the content of the attachment
for(int i =0;i<arrayObj.length;i++)
{
attachmentID =(String)arrayObj[i];
trace.addInfo((i+1) + ") Attachment Name: " + attachmentID);
Attachment attachment = inputAttachments.getAttachment(attachmentID);
String contentType = attachment.getContentType();
contentType = contentType + ";multipart/form-data;boundary=b2Lh0weilHCR3Aw6z30XSc-HGGYpw-LcKSA;"+ "name=\"" + attachmentID + "\"";
byte[] attachmentBytes = attachment.getContent();
Attachment renameAttachment = outputAttachments.create(attachmentID, contentType, attachmentBytes);
outputAttachments.setAttachment(renameAttachment);
}
return var1;
}
}
catch (Exception e)
{
e.printStackTrace();
}
return var1;
}
}
catch (Exception e)
{
e.printStackTrace();
}
return var1;
Thanks
Sandeep
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.