Is there any short way to convert java.time.ZonedDateTime to XMLGregorianCalendar?
Maybe I need some intermediate steps like convert ZonedDateTime to java.util.Date, but that will make code too messy.
The problem appeared in JAX-WS web services, datetime there is passed as XMLGregorianCalendar.
At the current moment I think it's the most straightforward way to do it:
ZonedDateTime now = ZonedDateTime.now();
GregorianCalendar gregorianCalendar = GregorianCalendar.from(now);
XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar);