on 02-11-2014 5:19 PM
Hello Experts,
We have a requirement to validate the attachment size in the incoming web service message.
Attachment size is coming as a field in web service message.
Condition : If attachment size is more than 3 MB , we need to remove the attachment and sends the message to target application after mapping.
If attachment size is less than 3 MB , we need to send message along with the attachment.
Please help how to achieve this. We are not going for BPM.
Thanks,
Ashish
Hi,
You have to create the udf. Pass size as a input to it.
Use remove attachment method to remove if condition is satisfied. Below one can give idea how to use attachment methods.
https://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/OutputAttachments.html
Regards,
Muni.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashish,
You can read the attachment size using an UDF and then remove the attachment accordingly.
Sample code:
String attachmentID = null;
AbstractTrace trace = container.getTrace(); ;
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
if (<YOUR CONDITION FOR ATTACHMENT SIZE>) //var1 - message size input value
{
try
{
if(inputAttachments.areAttachmentsAvailable() )
{
trace.addInfo("Attachments Available");
Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);
Object[] arrayObj = CollectionIDs.toArray();
for(int i =0;i<arrayObj.length;i++)
{
attachmentID =(String)arrayObj[i];
outputAttachments.removeAttachment(attachmentID);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return var1;
Regards,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
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.