Problem: InvalidDatatypeException on using pub.document: XMLValuesToDocument

Hi everyone!

I convert a JDBC-Adapter-Service-Output-DocumentType to a xml-string using the built in service pub.document:documentToXMLValues. Fields with datatype timestamp in the oracle db are represented in the output-xml-string as shown:

<?xml version="1.0" encoding="UTF-8"?>
<Values version="2.0">
...
  <date name="EINLAGERZEITPUNKT">2006-07-28</date>
  <date name="AUSLAGERZEITPUNKT">2006-07-30</date>
...
</Values>

If I try to take the way back using pub.document:XMLValuesToDocument to convert the string back to a document, I get a “com.wm.util.coder.InvalidDatatypeException: [ISC.0076.9006] decoding: date” error.
Here is a part of the stack trace:

 com.wm.util.coder.InvalidDatatypeException: [ISC.0076.9006] decoding: date
at com.wm.util.coder.XMLCoder.doDateDecode(XMLCoder.java:854)
at com.wm.util.coder.XMLCoder.doRecordDecode(XMLCoder.java:1283)
at com.wm.util.coder.XMLCoder.decode(XMLCoder.java:314)
at com.wm.util.coder.Coder.decodeFromBytes(Coder.java:104)
at pub.document.XMLValuesToDocument(document.java:92)

The webM IS Java API Reference says, that only values and numbers can be encoded by service pub.document:documentToXMLValues. So this could be a reason, why the values can not be decoded again. But why is the encoding working and resulting in a “date”-tag?

Can someone provide hints, how to get my pub.document:XMLValuesToDocument-Service to work?

Thanks in advance,
Max.

What version of IS are you using?

Mark

Hi Mark,

I´m using IS 6.1

Kind regards,
Max.

Max,

Don’t use documentToXMLValues, use the pub.xml:documentToXMLString instead. Then to go back to a document use pub.xml:xmlStringToXMLNode and pub.xml:xmlNodeToDocument. The Built-In Services Guide covers these services (which can be tricky) in detail.

HTH,

Mark

Mark,

the job is to read from a logfile containing xml. First I tried to use services pub.xml:xmlStringToXMLNode and pub.xml:xmlNodeToDocument after use of pub.file:getFile (as bytes) and pub.string:bytesToString, but this lead to a document on the pipeline that was totally unusable (e.g. some of the xml-fields may be empty, so some of the inner documents have been named “null”; the document contains several document lists).
As I found out, for generation of the logfile service pub.document:documentToXMLValues has been used, but the way back seems to be not the same than the approach!?

Kind regards,
Max.

Yes, that sounds like a pretty bad logging approach. Besides, logs are not usually used as a data source other than to display their contents in some meaningful way.

Mark

Mark,

I´m totally with you! Could you please inform my customer?? :wink:

I will alter the logging service to be able to log the data in a way that enables me to read and process them again.

Thanks for helping.

Kind regards,
Max.