Update document in TN...

Hi All,
I would like to know if it is possible to update the document content for the document stored in Trading Network ?? I have a requirement where I need to get the document out of TN, update the content of the document and reubmit the document to TN. I just want to update the content of the document and don’t want the document to be submitted as a new document.

Does anyone has any ideas how this can be done.

Thanks in advance.
Akshay.

Akshay,

No its not possible to update just the content and with out resubmitting doc with updated content.Basically you have to resubmit the entire document once you done with the update,so use pub.tn.doc:view service to get content.

HTH,
RMG

Hi Akshay,
Do you want to retreiw and update the content stored in the database.
Thanks,
Jay

Thank you RMG.

Jay, The document is stored in TN database and not in a separate database.

Thanks
Akshay

Hi Akshay,
Yes, Do you want to update the content of the document stored in the TN Database?
Thanks,
Jay

Akshay,

Regardless of whether there is a way to update the contents of a TN document (via a supported service or otherwise), I advise you DO NOT take this approach.

One of TN’s strongest features is the ability to maintain a transaction history of what your partners have sent to you and vice-versa. Once you start tampering with the data that was sent to/from your system, your history is no longer accurate, thus useless.

I always try to keep the documents in TN in their “purest” form (ie. the document right after it was received or right before it was sent.) If you must also keep a transformed version of the transaction in TN, submit it separately.

  • Percio

Hi Akshay,
It is possible to update the content of the document stored in the Trading Networks. You can even reprocess the document after changing the content without submitting it as a new document unless if you do not do any modification to the document identifying fields but its not advisable to change the content of the document stored in TN.

Basically all Tn documents are stored in a table in TN. You have to get the document from that table update the document and again save it in the same table. Each document is stored with an unique DocID to identify the document.

Query the BizDoc table for the given senderID and receiverID to get DocID.
All documents are stored in BizDocContent table with field name as content and datatype Blob.
Qeury the BizDocContent table with the DocID to get the Blob for the given DocID.
Convert the blob into string using custom java code and save it to the file. Also save the DocID to the file.

Make changes to the file content and again convert it into string and then into Blob.
Update the BizDocContent table with this Blob for the corresponding DocID.

I tried and it worked.

You will have an updated content in the TN database.

Thanks,
Jayadatta.

Jayadatta is right that you can use direct DB access to change the data. While this is technically feasible, I agree with Percio–don’t do it. Do not use IS/TN as an “app server.” IS/TN is a sophisticated messenger, not a message creator/editor.