Converting Large Idata document to xml Node.

Hello,

I am converting IS document to xml Node for routing the document to TN.
I am doing the following step for routing the document.

[B][FONT=Arial Narrow][SIZE=2][B][FONT=Arial Narrow][SIZE=4]

pub.xml:documentToXMLString

[/size][/font][/b]

[/SIZE][/FONT][/B][B][FONT=Arial Narrow][SIZE=4]

pub.xml:xmlStringToXMLNode

[/size][/font][/b][FONT=Arial Narrow][SIZE=4]

[LEFT][/size][/font]

[/LEFT]

routeXml

documeneToXMLString takes around 2 minutes to convert Document to XML String for around 50 K of sales Invoice records…But this above code is failing at xmlStringToXMLNode service . The IS is getting hanged and only option I have is to kill the IS java process and Sometimes I gives me out of Memory Error. I found couple of post stating to work with node iterator instead of loading entire document.

I guess pub.xml:getXMLNodeIterator and pub.xml:getNextXMLNode would not work in my case !!

How can I work with node iterator in my above case.

Also is their any other efficient way in which I can route the document to TN.

I think if you search the wMusers forums for large document handling or getXMLNodeIterator you should some useful threads.

The built-in services guide for those services should also be a good resource.

Mark

Hello,

Built in webMethods service like pub.xml:getXMLNodeIterator takes input as com.wm.lang.xml.Node XML node and returns iterator.
Once we have an iterator we can parse data chunk by chunk through pub.xml:getNextXMLNode service.
Now in my case I am actually trying to convert IData document or XML String into an com.wm.lang.xml.Node XML node.

So I guess the webMethods solution works fine when are converting or parsing com.wm.lang.xml.Node XML node to Idata or to an XML String but not vice versa.
Do let me know if I am wrong.

Thanks.

wm.tn.doc.xml:recordToBizdoc might be more memory friendly, but I’m not certain.

Hello,

I have tried running wm.tn.doc.xml:recordToBizdoc service. But even with this service my IS became un responsive and i had to kill its java process.
One more things i would like to share, it might to usefull to someone else.

I had this same problem with documentToXMLString service. After banging my head for a while I figured out that the I was not setting the buffer size in the input for documentToXMLString and also [FONT=Courier][SIZE=1]

watt.server.recordToDocument.bufferSize was set to default value. After changing this value documentToXMLString which was before taking more then a hour or somtimes even getting failed took less then 2 minutes to convert the entire IS document to XML String.:slight_smile:

But the problem still remains to convert XMLString to XML Node. :confused: !!

[/size][/font]

Hi,

If the problem is storing document inside TN, maybe you should try the following work around:

  1. Convert document you have to string and then to stream (either by stringToBytes, bytesToStream or by writing to temp file and streaming from there)

  2. Create a simple xml (envelope) and route it to TN for recognision

  3. Get bizdoc which is sent back from previous step and a add new content part to it (your actual file), which will be streamed to TN instead of being uploaded whole into memory.

Hope this helps.

Hello,

Does this mean that instead of routing the document in xml form I should convert document into an stream and then should route stream to TN ?

First you route (wm.tn.doc.xml:routeXml)to TN a very simple document, which will be used only for regonisition. Example:

[SIZE=2]<?xml version="1.0"?>
EnvelopeForLargeDocuments
12345

Of cource proper doc type must be defined on TN. Once you route it to TN, you receive back a bizdoc representing this document (let’s call it envelope). Now invoke wm.tn.doc:addContentPart to add actual document as new content part (call it “payload” for example) to envelope. Make sure that TN is configured for large documents handling.

If at any later time you need to access payload (for transport or transformation purposes) you first get bizdoc for given envelope (for example query depending on document name and document id), and then invoke wm.tn.doc:getContentPartData and set getAs = stream. This will allow you to work on stream only and not to load full document into memory.

[/size]

“1. Convert document you have to string and then to stream (either by stringToBytes, bytesToStream or by writing to temp file and streaming from there)”

Word of caution: bytesToStream doesn’t magically unload the bytes from memory. They are still there. To get something dropped from memory, it needs to be written to disk, then the stream opened against the file.

Hello,

The wm.tn.doc.xml:routeXml is not returning Bizdoc document in the output. The xml envelope routed is being recognized by TN and its also invoking the serivce defined in the action of processing rule.

I am calling the routeXML service from flow service. Is the bizdoc not returned because of this ?

routeXML should return bizdoc (among other output variables). trace it’s behaviour step by step, maybe you drop bizdoc somewhere in the middle. is bizdoc returned after recognize step in routeXML?

I am leaving on holidays on Monday for 2 weeks, so I won’t be able to respond till 13th May. good luck.

I had a TN property set to
tn.receive.clearKeys = node,bizdoc,sender,receiver,flags,ffdata,TN_Parms.

Because of this I was not able to get the Bizdoc in the output of routeXml service.