on 02-01-2013 5:25 PM
Hi experts,
I am trying get a zip file in base64 format that is into of this xml.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:mt_csa_source xmlns:ns0="urn:empresa.com:OU030:csa-fi">
- <rset>
- <row>
<FIELD>UEsDBAoAAAAAANZzOUJ1Y8G+GwAAABsAAAAKAAAAYXR0YWNoLnR4dEluZm9ybWF6aW9uZQ0KSW5mb3JtYXppb25lMlBLAQI/AAoAAAAAANZzOUJ1Y8G+GwAAABsAAAAKACQAAAAAAAAAIAAAAAAAAABhdHRhY2gudHh0CgAgAAAAAAABABgAwHajjgj7zQHAdqOOCPvNARiqbMkQ+s0BUEsFBgAAAAABAAEAXAAAAEMAAAAAAA==</FIELD>
</row>
</rset>
</ns0:mt_csa_source>
I can get the content and I decoded it and I put into a byte array, but the logs show me this error:
Adapter Framework caught exception: Exception in XML Parser (format problem?):'org.xml.sax.SAXParseException: Character reference "" is an invalid XML character.'
I tryed chand the xml version for 1.1, but this show me another error
Someone can help me?
Thanks
Hi Devaney,
After reading base64 content from XML and then decoding to binary (bytes) to which message structure you are passing this information? I mean, are you using graphical mapping with UDF which decodes base64 to bytes for target XML tag?
XML parsers can not handle binary content in XML tags. So, use java/ABAP mapping to achieve your requirement.
By the by, I can see the below content from your base64 zip content,
Informazione
Informazione2
Regards,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I understood and before I do this code, but in the end the whole process make two file, one is my file zip and the other one is a txt file with the base64 content:
UEsDBAoAAAAAANZzOUJ1Y8G+GwAAABsAAAAKAAAAYXR0YWNoLnR4dEluZm9ybWF6aW9uZQ0KSW5mb3JtYXppb25lMlBLAQI/AAoAAAAAANZzOUJ1Y8G+GwAAABsAAAAKACQAAAAAAAAAIAAAAAAAAABhdHRhY2gudHh0CgAgAAAAAAABABgAwHajjgj7zQHAdqOOCPvNARiqbMkQ+s0BUEsFBgAAAAABAAEAXAAAAEMAAAAAAA==
And I don't now why.
<code>
File f1 = new File(pathDest + File.separator + fileName);
FileOutputStream fos=null;
try {
fos = new FileOutputStream(f1);
fos.write(decodedBinary);
audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS, mVar
+ " The file path is "
+ f1.getAbsolutePath());
audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS, mVar
+ " The file name is "
+ fileName);
} catch (FileNotFoundException e) {
audit.addAuditLogEntry(key, AuditLogStatus.ERROR, mVar
+ " " + e.getMessage());
} catch (IOException e) {
audit.addAuditLogEntry(key, AuditLogStatus.ERROR, mVar
+ " " + e.getMessage());
}finally{
try {
fos.close();
} catch (IOException e) {
audit.addAuditLogEntry(key, AuditLogStatus.ERROR, mName
+ e.getMessage());
}
}
</code>
Thanks
Hi Devaney,
Have you developed a custom module to achieve your requirement? Second thing is that, you are using file I/O in module code. So obviously two files will be created. One is with File I/o code in your java module code, the second one is with File receiver channel.
I do not think you need a custom java module to do this. You can do this with java mapping (at mapping level).
By the by, What is your PI version?
Regards,
Praveen Gujjeti
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.