Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
tahir_z
Contributor

As for one of my requirement, i had to rename the attachment payload name and description of the file(zip/jpeg/pdf etc..) which written in manifest file. I'm sure there is standart classes to make this happen such as PayloadSwapBean. If you are familiar of creating custom adapter module this can be done in this way as well.

Developer's who are not familiar of creating custom adapter module can follow this blog : How to create SAP PI adapter modules in EJB 3.0

Requirement,


Changing the name which "attachment-1" to as desired name




Manifest log file contains name and description




Here is a piece of code to apply,




public ModuleData process(ModuleContext mc, ModuleData md) throws ModuleException {
  // TODO Auto-generated method stub
  AuditAccess audit = null;
  try {
  audit = PublicAPIAccessFactory.getPublicAPIAccess().getAuditAccess();
  } catch (MessagingException e2) {
  // TODO Auto-generated catch block
  e2.printStackTrace();
  }
  Message message = (Message) md.getPrincipalData();
  key = new MessageKey(message.getMessageId(), message.getMessageDirection());
  payloadValue = mc.getContextData("payloadname");
  Payload attachment = message.getAttachment(payloadValue);
  //audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS, "Attachment ->"+attachment.getInputStream());
  try {
  attachment.setName("VODAFONETR-attachment1");
  attachment.setDescription("VODAFONETR-attachment");
  md.setPrincipalData(message);
  }catch (InvalidParamException e) {
  // TODO Auto-generated catch block
  audit.addAuditLogEntry(key, AuditLogStatus.ERROR, "InvalidParamException ->"+e.toString());
  }
  return md;
  }

Applying custom adapter module development to SOAP Sender Adapter Channel,

Here is the result,

Manifest log file,

Hope this helps to anyone requirements.

Labels in this area