on 02-01-2011 5:16 PM
hi
i am having file to RFC scenario, and the input file is an xml file and i am getting erron in mapping as below but when i download the payload and load it in the integration repository mapping tool ,i am able to execute it succesfully. i think the problem is with the encoding , i tried with processing it in utf-8 and ansi. both the format it is giving the sam error.
<SAP:Stack>Runtime exception occurred during application mapping com/sap/xi/tf/_MMMMMMMMM_; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Invalid char #0xb (:main:, row:1, col:4~</SAP:Stack>
regards
sandeep
0b is a vertical tab.
Is it a tab delimited file and your content conversion is not correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Considering the following invalid characters. You can use the below code to filter these characters:
#x9 , #xA , #xD , [#x20-#xD7FF] , [#xE000-#xFFFD] , [#x10000-#x10FFFF]
public String stripNonValidXMLCharacters(String in) {
StringBuffer out = new StringBuffer(); // Used to hold the output.
char current; // Used to reference the current character.
if (in == null || ("".equals(in))) return ""; // vacancy test.
for (int i = 0; i < in.length(); i++) {
current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught here; it should not happen.
if ((current == 0x9) ||
(current == 0xA) ||
(current == 0xD) ||
((current >= 0x20) && (current <= 0xD7FF)) ||
((current >= 0xE000) && (current <= 0xFFFD)) ||
((current >= 0x10000) && (current <= 0x10FFFF)))
out.append(current);
}
return out.toString();
}
Thanks,
Aravind
Hi Stefen /ajnayak ,
So java mapping only supports thes (#x9 , #xA , #xD , x20-#xD7FF , xE000-#xFFFD , x10000-#x10FFFF) and dont support 0xb(vertical tab), So i cant do any thing in PI, and i should ask the sender application to Avoid it right
public String stripNonValidXMLCharacters(String in) {
StringBuffer out = new StringBuffer(); // Used to hold the output.
char current; // Used to reference the current character.
if (in == null || ("".equals(in))) return ""; // vacancy test.
for (int i = 0; i < in.length(); i++) {
current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught here; it should not happen.
if ((current == 0x9) ||
(current == 0xA) ||
(current == 0xD) ||
((current >= 0x20) && (current <= 0xD7FF)) ||
((current >= 0xE000) && (current <= 0xFFFD)) ||
((current >= 0x10000) && (current <= 0x10FFFF)))
out.append(current);
}
return out.toString();
}
Thanks,
sandeep
Edited by: pendyalas on Feb 2, 2011 11:09 AM
I think you dont understand Stefan's reply. This code will fix the issue.
The java code checks for only valid characters in this logic. If your vertical tab char appears , the code will ignore that character and take care your issue. Sure , you could try to fix the problem at the sender application too.
hi,
we are allready using graphical mapping and xslt together in this interface, so i can now include a java mapping with the code mentioned above before to these, to remove the invalid characters .
We can also do the correction in sender application i.e sap R3, but that even has to be done by me . as it is and idoc which is generated as xml. and xi file adapter is picking it . instead of generating the xml file can we try to post directly to PI as idoc and then will it resolve the issue.as the note 1004368 will help if it is an idoc
regards
sandeep
Edited by: pendyalas on Feb 2, 2011 8:48 PM
Edited by: pendyalas on Feb 2, 2011 8:54 PM
Edited by: pendyalas on Feb 2, 2011 8:55 PM
hi Stephen ,
The problem is all the idoc that were generated in the day will be packed into single xml file and generated. and then PI picks this file to process. So can this be done using PI by directly posting as the idocs.instead of generating xml file at the end of the day
regards
sandeep
Edited by: pendyalas on Feb 3, 2011 4:57 PM
>> This is possible only with PI 7.1 ehp1.
Yes !Our verstion is SAP EHP 1 for SAP NetWeaver 7.1 so how can i do this.
__instead for fixing in PI i can use the belwo java mapping__
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
public final class MyMapping implements StreamTransformation {
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
// removing non valid characters
BufferedReader br = new BufferedReader(in);
out = stripNonValidXMLCharacters(br.readLine());
// implement mapping ...
}
public String stripNonValidXMLCharacters(String in) {
StringBuffer out = new StringBuffer(); // Used to hold the output.
char current; // Used to reference the current character.
if (in == null || ("".equals(in))) return ""; // vacancy test.
for (int i = 0; i < in.length(); i++) {
current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught here; it should not happen.
if ((current == 0x9) ||
(current == 0xA) ||
(current == 0xD) ||
((current >= 0x20) && (current <= 0xD7FF)) ||
((current >= 0xE000) && (current <= 0xFFFD)) ||
((current >= 0x10000) && (current <= 0x10FFFF)))
out.append(current);
}
return out.toString();
}
}
regards
sandeep
Edited by: pendyalas on Feb 4, 2011 2:07 PM
Hi Sandeep,
Can you paste here the the payload which is going to graphical mapping, make sure that it selected as "code <>".
Regards,
Raghu_Vamsee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandeep,
Hopefully, the below link might be useful to you.
http://en.wikipedia.org/wiki/Byte-order_mark#UTF-8
Regards,
Rajesh
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
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.