I'm trying to consume a SOAP service with Java. I need to set a date/time element properly.
<element maxOccurs="1" minOccurs="0" name="startDate" nillable="true" type="xsd:dateTime"/>
I generated a client jar with Axis 1.4 wsdl2java
I need to send a Calendar type object.
java.util.Calendar startDate
In SOAPUI, it accepts the format below.
<startDate>22/05/2022 14:27:00.000</startDate>
In code, I tried formatting the date but didn't work. I get the same error every time while getting response.
AxisFault java.lang.NumberFormatException Invalid date/time
Any ideas?
xsd:dateTime
expects a value in the ISO 8601 format e.g.2022-05-22T14:27:00.000
which is in the patternyyyy-MM-dd'T'HH:mm:ss.SSS
. Learn more about it from this tutorial.Note: The
java.time
API has a constant,DateTimeFormatter.ISO_LOCAL_DATE_TIME
as a pre-defined pattern.