on 04-03-2012 9:09 PM
I have a scenario where sender and receiver both are webservices. Sender will be sending couple of attachments along with payload. I would need to rename the attchment names to a different name in XI at mapping level so that receiver will receiver and sender will not have same file names.
Can you please suggest if this is possible? If possible, Please share java code to do that?
Thanks and Regards,
Raveendra
Hi Raveendra Babu,
You could create an UDF (user defined function) in the graphical mappind and to use the interfaces InputAttachments and OutputAttachments.
You could try with this examples to begin, although you should to debug the code:
To read Yugapreetha T's code in http://scn.sap.com/thread/1341089:
String Content = "";
String AttachmentID ="";
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
if(inputAttachments.areAttachmentsAvailable())
{
Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);
Object[] arrayObj = CollectionIDs.toArray();
int attachmentCount = arrayObj.length;
for(int i =0;i<attachmentCount;i++)
{
AttachmentID =(String) arrayObj<i>;
Attachment attachments =inputAttachments.getAttachment(AttachmentID);
Content = Content + attachments.getContent().toString();
}
}
return Content;
To write: (http://scn.sap.com/thread/1953315 - Rene Pilz answer)
try {
GlobalContainer globalContainer = container.getGlobalContainer();
OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
Attachment attachments = outputAttachments.create(filename, mimeType,content);
return "Adde1: "+filename+" and attachments is null? "+ (attachments==null);
} catch (Exception e) {
return e.toString();
}
Javadoc: https://help.sap.com/javadocs/pi/SP3/xpi/index.html
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raveendra,
As far as i know the SOAP attachments inside the PI, the PI-SOAP messages, have no name they have a guid to identify them:
http://help.sap.com/saphelp_nw73/helpdata/en/48/bd87a00e7d0783e10000000a42189d/content.htm
http://www.w3.org/TR/SOAP-attachments
May be I'm wrong, we could expect if someone could give us some light about this issue
Regards.
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.