on 02-25-2014 12:07 PM
Hi,
I have a requirement where I need to retrieve a word document in solution manager, and add the content in an xml tag.
Is this possible?
I managed to retrieve the document and converted into binary format and ready to send it via abap proxy.
Is it possible to load the data content in an xml tag? How do i do that?
Regards
Krish
Hi Krish,
The below link might help
How to Send Binary Data to RFC from XI(or)PI - Process Integration - SCN Wiki
regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Harish,
Thanks for the links.
My question is mainly not about converting binary to xml but will it practically work when you convert a word document into binary and display it to xml code.
The binary file will not only contain the data of the document but also all its attributes. When I display it in XML, I am not sure whether only the data will be present or also all its attributes.
Remember, we are not converting word document into text file or csv, we are just converting from doc to binary to xml. Imagine, what will happen if it is a pdf or image file.
Regards
Krish
Hello Harish,
So without conversion agent or similar tools, it is not possible right?
When you worked with converting Binary to XL and vice versa, there was no requirement of displaying the data in normal XML tag. I think you would have just sent the binary data into these xml tags.
Regards
Krish
Hi AnandhaKrishnan,
If you put binary data into xml there is 99.99% chance that the XML will become invalid. The binary files will contain characters not allowed in XML. The only way to prevent this is to stop the parser from interpreting the binary content. You can put the content in CDATA segment then parser will not interpret the same. From your post above I can make out that you need the content of the word document and not other attributes. In this case I would suggest to use a java mapping code to read only the content of word document and create a target xml out of it.
To read the content of the XML you can use Apache POI - the Java API for Microsoft Documents .
Here is a reference to such a code
http://sanjaal.com/java/120/java-file/how-to-read-doc-file-using-java-and-apache-poi/
Regards
Anupam
Hi Anupam,
Thanks for the post. To give more detailed information. I would need to lookup all documents stored in solution manager for a particular timing and send it through ABAP proxy and then to PI target structure.
My concern is that the documents might be a word/excel/pdf/ppts.
Someone else suggested that it will need to be converted first from binary to xstring and then being sent to PI.
Even if we filter for word and pdf documents only, extracting the content and displaying the content in an xml tag looks bit complicated. Please throw in your recommendations.
Regards
Krish
Hi Krish,
It is not necessary to convert to xstring before sending the files to PI.
We can have a single java mapping code in PI server which reads file extension and process it accordingly. Thus we have java apache library to read word/excel/PDF files. You can embed the entire file content into CDATA segment and send it to PI server. PI interprets the CDATA segment according to filename extension and generates a target XML. Its not complicated to work with these files. I would suggest you to write simple codes to read these files. In case you face problems please come back to the forum.
Regards
Anupam
Hi Krish,
you can directly read the files from Solman server using sender FTP adapter. Thus there will be no need of abap. In such case putting the file content into CDATA segment is not necessary.
Then in PI server the file would come as a binary byte stream. Java mapping code would interpret the contents and create XML equivalent.
In case you want to do the same using ABAP proxy then you need abap code creating the XML and putting file contents into an XML CDATA segment.
Regards
Anupam
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.