on 03-31-2014 8:50 PM
Hi,
PI system has exposed a web service out of the following structure for the outside party to call
<MAT>
<doc type>pdf</doc type
<subnumber>1234</subnumber>
<id>45ABC<id>
<matno>ABCD</matno>
<filename>transaction1.pdf</filename>
</MAT>
When the outside party submits a web service request, I have to read the <filename> value (transaction1.pdf) and get the file from the file location which is local and convert the file to byte array.
How do I do this in message mapping or java mapping? Any help is greatly appreciated
thx
mike
Hi. Michael.
You need another scenario to red the PDF file.
You can use a java mapping, to read the PDF file.
Also you can check this document.
Regards
Lucho.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think I can use another scenario because it has to be in the same scenario where in webservice request comes to PI and PI use a look up file as shown in the below link to get the file from the ftp location
File Lookup in UDF - Process Integration - SCN Wiki
Can I use this for PDF? And also how would the code looks like in my case for reading pdf and convert to byte array.
thanks
mike
Hi. you can use this UDF to convert the PDF to byteArray.
public static byte[] loadFile(String sourcePath) throws IOException {
byte[] buffer = new byte[8192];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream inputStream = null;
int bytesRead;
try {
inputStream = new FileInputStream(sourcePath);
while ((bytesRead = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, bytesRead);
}
} finally {
if (inputStream != null) {
inputStream.close();
}
}
return baos.toByteArray();
}
User | Count |
---|---|
88 | |
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.