I have a requirement to convert com.wm.lang.xml.Document object to stream object using a Java service in Developer, any help would be appreciated.
Scenario: Partner is posting MIME data on to IS and the size of it is between 400 MB- 500 MB. Converting the incoming XML stream to document and document is not an option, since in this case the service xmlDocumentToString is throwing out of memory exception while parsing the incoming stream. I have written a Java service which will tell me what i am receiving in the Developer and that is com.wm.lang.xml.Document. Now i have to convert this object to a stream so that i can can later change to string and store it to a file system.
You are heading down the wrong path. You do not need/want to convert the Document object to a stream as by the time you have the Document object, it is too late–it is already completely loaded into memory (if memory is not already exhausted).
Review the material about large document handling.
[Side note] There really isn’t a notion of “converting” an object to a stream. Streams are used for I/O (to/from disk or over the network). You may find it helpful to review the Sun Java documentation concerning streams and serializable objects.
I was going through the XML services Developers guide about the handling techniques but could not get much information. Do you have any other documents in mind you suggest that will help me in handling this large XML?
Unfortunately the information is scattered. There is some in the IS Administrator’s Guide, the EDI user’s guide, the Trading Networks Administrator’s Guide and Concepts Guide, and the Built-in Services Reference (in service descriptions and usage notes).
There is a GEAR 6 (not 6.5) implementation guide that has some information about large document handling as well. There is a large doc handling sample available on Advantage. It’s in the WmSamples I believe.
Basically, you’ll want to ensure that the XML content handler streams the XML doc to disk and that your service uses a node iterator to process the stream in chunks.
I know this isn’t much info but I hope it is enough to get you started on the right path.