Author |
Message
|
thyssen |
Posted: Wed Jul 15, 2009 4:41 am Post subject: Problems when changing dateTime settings in XML wire format |
|
|
Novice
Joined: 07 May 2007 Posts: 13
|
Hello,
we have just created a namespace aware message set from an xsd message definition file. It contains both elements and attributes based on data type xsd:dateTime:
xsd element definition:
===============
<xsd:complexType name="ProduktionswegType">
<xsd:sequence>
...
<xsd:element name="ZeitpunktLetzterEinsatz" type="xsd:dateTime" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
xsd attribute definition:
===============
<xsd:complexType name="TelegrammElementType">
...
<xsd:attribute name="Zeitpunkt" type="xsd:dateTime"/>
</xsd:complexType>
We have changed the datetime setting in then XML wire format of the message set in order to use yyyy-MM-dd'T'HH:mm:ss.SSS'Z' as default dateTime format. However, we receive a mixed output in the target XML message:
<Telegramm Id="105" KorrelationId="" Sender="DO.KF" Zeitpunkt="2009-07-13T12:50:29.200Z"></Telegramm>
<ZeitpunktLetzterEinsatz>2009-05-26 15:31:10.790</ZeitpunktLetzterEinsatz>
We would like to obtain the attribute dateTime presentation throughout the whole output message. Any hints for that? |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Jul 15, 2009 4:57 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Are you doing full validation on the Message?
If not then it might be easier to change the 'non-standard' datetime field to a string and validate it manually later in the flow. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
thyssen |
Posted: Wed Jul 15, 2009 6:02 am Post subject: |
|
|
Novice
Joined: 07 May 2007 Posts: 13
|
Hello,
first we build the MRM message structure using ESQL within a Compute Node. Afterwards we use a RCD Node to parse the message as XML. All dateTime elements and attributes are passed as GMTTIMESTAMP using a common function. Leaving the RCD Node we can see that the dateTime fields based on attributes are formatted as 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z' whereas those based on elements appear as
'yyyy-MM-dd HH:mm:ss.SSS'. Can you give me some hints which parameters I might change (RCD node, MQOutput node etc.)?
CALL CopyMessageHeaders();
SET OutputRoot.Properties.MessageSet = 'QUINTIQ';
SET OutputRoot.Properties.MessageType = 'Lagerung';
SET OutputRoot.Properties.MessageFormat = 'XML1';
...
SET OutputRoot. ... .Ereignis.Zeitpunkt = MapTimestamp(CobolHeader.EREIGNIS.EREIGNIS_ZEITPUNKT);
...
CREATE FUNCTION MapTimestamp(IN CobolTimestamp CHAR) RETURNS GMTTIMESTAMP
BEGIN
RETURN CAST(NULLIF(CobolTimestamp, '') AS GMTTIMESTAMP FORMAT 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z');
END; |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 15, 2009 9:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
thyssen I believe you may have a problem in your format:
Check out the difference between the 2 following:
FORMAT 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z'
FORMAT 'yyyy-MM-dd''T''HH:mm:ss.SSSZ'
By the way the default format uses:
FORMAT 'yyyy-MM-dd''T''HH:mm:ss.SSSZZZ'
From your output it looks like the Z gets treated as a letter and not as time zone indicator. If your intent was to have an apostrophy before the time zone you may have to do something like SSS'''Z (no guarantees here).
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
thyssen |
Posted: Wed Jul 15, 2009 10:58 pm Post subject: |
|
|
Novice
Joined: 07 May 2007 Posts: 13
|
Our simple intent is to pass a timestamp string (24 bytes, e.g. "2009-07-15:12:00:01.123Z" ) which we receive from a cobol input message to the final XML structure as is. I think the xsd:dateTime format in the target structure causes the problems. Actually we thought that casting the input string as GMTTIMESTAMP and formatting on the output would solve the problem. Changing the datetime settings in the XML wire format to yyyy-MM-dd'T'HH:mm:ss.SSS'Z' seemingly works for attributs but not for elements.
Any ideas? |
|
Back to top |
|
 |
thyssen |
Posted: Thu Jul 16, 2009 1:21 am Post subject: |
|
|
Novice
Joined: 07 May 2007 Posts: 13
|
The WBI Information Center says:
"The initial value for this property is yyyy-MM-dd'T'HH:mm:ssZZZ, which you can change by over-typing.
You can override this property for an element or attribute within a complex type."
Therefore we can use
yyyy-MM-dd' the way ... 'HH:mm:ss.SSS' ... we want it ...'
and the output for the attribute datetime field is
<Telegramm Id="105" KorrelationId="" Sender="DO.KF" Zeitpunkt="2009-07-13 the way ... 12:50:29.200 ... we want it ..."></Telegramm>
However, the element datetime field is displayed as
<ZeitpunktLetzterEinsatz>2009-05-26 15:31:10.790</ZeitpunktLetzterEinsatz>
Is that a bug? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 16, 2009 2:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
thyssen wrote: |
The WBI Information Center says:
"The initial value for this property is yyyy-MM-dd'T'HH:mm:ssZZZ, which you can change by over-typing.
You can override this property for an element or attribute within a complex type."
Therefore we can use
yyyy-MM-dd' the way ... 'HH:mm:ss.SSS' ... we want it ...'
and the output for the attribute datetime field is
<Telegramm Id="105" KorrelationId="" Sender="DO.KF" Zeitpunkt="2009-07-13 the way ... 12:50:29.200 ... we want it ..."></Telegramm>
However, the element datetime field is displayed as
<ZeitpunktLetzterEinsatz>2009-05-26 15:31:10.790</ZeitpunktLetzterEinsatz>
Is that a bug? |
Not necessarily. You'd have to first check the element's definition and verify that it does not have it's own timestamp format associated to it. Remember there might be an implicit default format on xsd:datetime.
Now you could change your xsd to attribute the valid format to each of your datetime fields and check in the msxd that the format is taken from the element definition... (check box somewhere?)
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
thyssen |
Posted: Thu Jul 16, 2009 4:09 am Post subject: |
|
|
Novice
Joined: 07 May 2007 Posts: 13
|
Hello,
in the xsd both element and attribut definition refer to the native datatype xsd:dateTime. In the physical representation of the XML wire format both use yyyy-MM-dd'T'HH:mm:ss.SSS'Z' as datetime format which obviously is propagated from the setting in "messageSet.mset".
Can you show me how to check in the msxd that the format is taken from the element definition? Any further ideas?
xsd element definition:
===============
<xsd:complexType name="ProduktionswegType">
<xsd:sequence>
...
<xsd:element name="ZeitpunktLetzterEinsatz" type="xsd:dateTime" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
xsd attribute definition:
===============
<xsd:complexType name="TelegrammElementType">
...
<xsd:attribute name="Zeitpunkt" type="xsd:dateTime"/>
</xsd:complexType> |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 16, 2009 7:10 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Forget the xml. You need to have a look at the graphical representation and see if you can add a format to the datetime element. Maybe in the constraints ? Alternatively you can open a PMR with IBM. Might get you the solution way faster...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|