diff --git a/src/main/java/com/sforce/ws/bind/TypeMapper.java b/src/main/java/com/sforce/ws/bind/TypeMapper.java index 76df672b..2e708a18 100644 --- a/src/main/java/com/sforce/ws/bind/TypeMapper.java +++ b/src/main/java/com/sforce/ws/bind/TypeMapper.java @@ -48,6 +48,7 @@ import java.math.BigDecimal; import java.time.*; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalQueries; import java.util.*; @@ -66,6 +67,8 @@ public class TypeMapper { private static final HashSet<String> keywords = getKeyWords(); private static HashMap<String, Class<?>> primitiveClassCache = getPrimitiveClassCache(); + private static final DateTimeFormatter DTF = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX"); + // True if interfaces are generated for the WSDL private boolean generateInterfaces; private boolean generateExtendedErrorCodes; @@ -421,7 +424,7 @@ private void writeSingleObject(XmlOutputStream out, TypeInfo info, Object value) String s = calendarCodec.getValueAsString(value); writeSimpleType(out, info, s, true, Calendar.class.getName()); } else if (value instanceof OffsetDateTime) { - writeSimpleType(out, info, value.toString(), true, OffsetDateTime.class.getName()); + writeSimpleType(out, info, DTF.format((OffsetDateTime)value), true, OffsetDateTime.class.getName()); } else if (value instanceof OffsetDate) { writeSimpleType(out, info, value.toString(), true, OffsetDate.class.getName()); } else if (value instanceof OffsetTime) { @@ -445,7 +448,6 @@ private void writeSingleObject(XmlOutputStream out, TypeInfo info, Object value) writeString(out, info, value.toString(), true); } } - private void writeNull(XmlOutputStream out, TypeInfo info) throws IOException { out.writeStartTag(getNamespace(info), info.getName()); out.writeAttribute(Constants.SCHEMA_INSTANCE_NS, "nil", "true");