Author |
Message
|
zhumingvictor |
Posted: Thu Aug 01, 2013 8:15 am Post subject: Mapping xs:Datetime with timezone. |
|
|
Novice
Joined: 10 May 2013 Posts: 17
|
Hi, I am using a SOAPRequest node to send request, before I send the request I have to do a data mapping using Mapping node. But the WS I am calling requires xs:DateTime with timezone info e.g. 2013-01-01T00:00:00-05:00. But the timestamp in esql won't keep it's timezone, no matter what I do the trace of the mapped data will only have 2013-01-01T00:00:00 with adjusted time base on the timezone.
Anything I can do? |
|
Back to top |
|
 |
fatherjack |
Posted: Thu Aug 01, 2013 8:47 am Post subject: Re: Mapping xs:Datetime with timezone. |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
zhumingvictor wrote: |
Hi, I am using a SOAPRequest node to send request, before I send the request I have to do a data mapping using Mapping node. But the WS I am calling requires xs:DateTime with timezone info e.g. 2013-01-01T00:00:00-05:00. But the timestamp in esql won't keep it's timezone, no matter what I do the trace of the mapped data will only have 2013-01-01T00:00:00 with adjusted time base on the timezone.
Anything I can do? |
What have you tried? Have you looked at the stuff about formatting and parsing dateTimes as strings in the InfoCenter? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
zhumingvictor |
Posted: Thu Aug 01, 2013 8:51 am Post subject: |
|
|
Novice
Joined: 10 May 2013 Posts: 17
|
The input is a string in format of yyyyMMdd and I am coverting it to timestamp in using custome esql in Mapping node. The output is a xs:DateTime format. I tried to cast the date string to GMTTimestamp format, also tried to format the string as 2012-01-01T00:00:00-05:00 but the output always got converted to the date base on time zone and the timezone info will get lost. |
|
Back to top |
|
 |
fatherjack |
Posted: Thu Aug 01, 2013 9:40 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
zhumingvictor wrote: |
The output is a xs:DateTime format. |
Whats the DateTime Format of this field? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Aug 01, 2013 9:40 am Post subject: Re: Mapping xs:Datetime with timezone. |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
zhumingvictor wrote: |
I have to do a data mapping using Mapping node.
Anything I can do? |
Why do you HAVE to use a mapping node. Whats wrong with a Compute node? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 01, 2013 9:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What's the XSD specify for the field? |
|
Back to top |
|
 |
zhumingvictor |
Posted: Thu Aug 01, 2013 9:46 am Post subject: |
|
|
Novice
Joined: 10 May 2013 Posts: 17
|
I know I can using compute node to replace the Mapping node, but a simple mapping node can save me lots coding and Mapping node is more clear to look at and easier to understand for the developer who will maintain it. I think that's the reason why IBM added such node.
The XSD format in the output is xs:DateTime. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 01, 2013 9:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
zhumingvictor wrote: |
The XSD format in the output is xs:DateTime. |
Does it specify a lexical representation that includes a timezone qualifier? or does it specify the default lexical representation? |
|
Back to top |
|
 |
zhumingvictor |
Posted: Thu Aug 01, 2013 10:07 am Post subject: |
|
|
Novice
Joined: 10 May 2013 Posts: 17
|
mqjeff wrote: |
zhumingvictor wrote: |
The XSD format in the output is xs:DateTime. |
Does it specify a lexical representation that includes a timezone qualifier? or does it specify the default lexical representation? |
The XSD doesn't require it but behind the ws the Java code requires it and The Java code behind it is out of my control. |
|
Back to top |
|
 |
dogorsy |
Posted: Thu Aug 01, 2013 10:15 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
if the xsd specifies xs:DateTime all you need to do is to map an ESQL data type of timestamp. That will create a field that will be compliant with the xsd.
The java code will have to take an xs:DateTime. If the requirement for the field is different, then you need to ask for the XSD defining the field to be changed accordingly. |
|
Back to top |
|
 |
fatherjack |
Posted: Fri Aug 02, 2013 12:32 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
zhumingvictor wrote: |
The XSD doesn't require it but behind the ws the Java code requires it and The Java code behind it is out of my control. |
So this is nothing to do with how to format a datetime to include a timezone (which ia actually very simple to do) but rather its a question of "the target system gave me an xsd which isn't correct".
If they gave you an xsd that said field X was a string and you populated it with 'abc' and then they said "our Java code isn't working because we need field X to contain an integer" would you have posted a question to this forum? I suspect not! _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
|