on 11-17-2014 6:20 PM
Hi experts,
So I have issue here to read the XML files from e-mail attached.
When the content type of the XML is defined as - text/xml or application/octet-stream the SAP PI do not read the MailAttachment-1 and get an error.
Check imagem below:
So I already use the MessageTransformBean to convert that, but maybe I did wrong configuration:
Somebody have the same issue ?
Kind regards,
BR.
Ricardo Viana.
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 Ricardo, what does the error say?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ricardo
Standard adapter modules only work on the main payload, unless you swap it with the swap bean. Since for your case using swap bean is out of the question due to multiple attachment, a possibility would be adding additional code in your custom module as suggested by Amit.
You can try it with the following logic that iterates over all the attachment and changes the content type.
Iterator iter = msg.getAttachmentIterator();
while(iter.hasNext()) {
XMLPayload attachment = (XMLPayload) iter.next();
attachment.setContentType("application/xml");
}
Rgds
Eng Swee
Eng,
I´m trying to include it, but not working, look small part of my code:
String attachId = "";
Attachment attach = null;
String strAcumulaDados = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<ns0:Messages xmlns:ns0=\"http://sap.com/xi/XI/SplitAndMerge\">";
String attType = "";
while (itAtt.hasNext()) {
if ( attachId.length() > 0 )
output.getOutputAttachments().removeAttachment(attachId);
attachId = (String) itAtt.next();
attach = ipAtt.getAttachment(attachId);
attType = attach.getContentType();
}
if (attType.contains("xml")) {
String XML = "";
XML = this.getUTF8(attach.getContent());
I´m using a java mapping with multimapping to collect the attachments and the rest of work is with InterfaceColletion.
Regards,
Hi Ricardo
The code that I provided above was for the custom adapter module GetMultiAnexoXml2 that was shown in your module screenshot. It's just to change the content type for attachments to application/xml as you requested for, and it's not applicable for Java mapping.
Not sure what is your design - what is being done in module and what is being done in Java mapping.
Anyway, had a look at your code and here are some of my comments:-
i) itAtt not defined anywhere
ii) attachId is initialized to blank and not updated, so the condition attachId.length > 0 will never be true.
Rgds
Eng Swee
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.