xsd dateTime 丢失通过 JAX-WS 通过 Websphere ESB 传递的时区信息
我正在使用 JAX-WS (WAS 7) --> Websphere ESB 7 --> JAX-WS (WAS 7),用时间戳填充 xsd:dateTime 字段。
流程如下:
- WAS - 实例化响应对象
- 填充 POJO 中的 XMLGregorianCalendar 字段 [
DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar)Calendar.getInstance())
]“2010-11-02T15: 35:42.047+13:00"
- 通过 ESB 将响应传回
- 检查网关“
2010-11-02T02:35:42.047Z
”中的响应
正如您所看到的,新西兰时区信息被忽略。返回的 XMLGregorianCalendarImpl.timezone=0
,实例化时为 XMLGregorianCalendarImpl.timezone=780
。
POJO 是使用“JDK 6 中的 JAX-WS RI IBM 2.1.1”生成的,
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MessageControl", namespace = "http://xmlschema.customer.co.nz/generic/Response123", propOrder = {
"messageTrackTrace",
"messageDate",
})
public class PojoClass {
@XmlElement(name = "MessageTrackTrace")
protected String messageTrackTrace;
@XmlElement(name = "MessageDate", required = true)
protected XMLGregorianCalendar messageDate;
这是 ESB 中的错误吗?也许我可以更改配置? 干杯
I'm using JAX-WS (WAS 7) --> Websphere ESB 7 --> JAX-WS (WAS 7), populating a xsd:dateTime field with a timestamp.
Here's the flow:
- WAS - Instantiate Response object
- Populate XMLGregorianCalendar field in POJO [
DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar)Calendar.getInstance())
]"2010-11-02T15:35:42.047+13:00"
- Pass response back through ESB
- Examine response in gateway "
2010-11-02T02:35:42.047Z
"
As you can see the NZ timezone info is ignored. The returned XMLGregorianCalendarImpl.timezone=0
, where it was XMLGregorianCalendarImpl.timezone=780
when it was instantiated.
The POJO is generated with the "JAX-WS RI IBM 2.1.1 in JDK 6" as
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MessageControl", namespace = "http://xmlschema.customer.co.nz/generic/Response123", propOrder = {
"messageTrackTrace",
"messageDate",
})
public class PojoClass {
@XmlElement(name = "MessageTrackTrace")
protected String messageTrackTrace;
@XmlElement(name = "MessageDate", required = true)
protected XMLGregorianCalendar messageDate;
Is this a bug in ESB? Perhaps there is a configuration I can change?
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢瑞安的想法,
我通过从日期填充新的 XMLGregorianCalendar 解决了这个问题。
这保持了我想要的格式,即“太平洋/奥克兰”时区。
干杯
Thanks for the thought Ryan,
I solved it by populating a new XMLGregorianCalendar from a Date.
This maintains the format I want i.e. 'Pacific/Auckland' timezone.
Cheers