Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

Changing attachment name or description of PI payload

$
0
0

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


1.PNG



Manifest log file contains name and description


2.PNG



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,

 

 

5.PNG

 

 

Here is the result,

 

 

Manifest log file,

 

4.PNG

 

 

 

3.PNG

 

 

 

 

 

Hope this helps to anyone requirements.


Viewing all articles
Browse latest Browse all 2548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>