<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Axis2 Date Converter</title><link>https://answers.axonivy.com/questions/1952/axis2-date-converter</link><description>&lt;p&gt;I'm calling a external web service with a "Web Service Step".  The serialization of a java.util.Date field generates for example this line :: &amp;lt;documentdate&amp;gt;2016-08-10+01:00&amp;lt;/documentdate&amp;gt;&lt;/p&gt;
&lt;p&gt;Is there a way to change this behavior so the serialization converts the date to string without the timezone?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1952/axis2-date-converter" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 30 Aug 2016 02:27:12 -0400</lastBuildDate><item><title>Answer by Genzer Hawker</title><link>https://answers.axonivy.com/questions/1952/axis2-date-converter/1999</link><description>&lt;p&gt;Hi tiago&lt;/p&gt;
&lt;p&gt;You may want to create a override, call &lt;code&gt;customClass&lt;/code&gt; in &lt;code&gt;axis2&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class ConvertDateWithoutTimeZone extends ConverterUtil {

    public static String convertToString(java.util.Date value) {
        /*
         * Since SimpleDateFormat is not thread-safe. We have to create a new
         * instance every time we need to format a Date.
         */
        return new SimpleDateFormat("yyyy-MM-dd").format(value);
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;1st approach&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You may want to package your class into a JAR file, put it in the &lt;code&gt;${ivy.engine}/webapps/ivy/WEB-INF/&lt;/code&gt; and follow the way to set the system property as described in &lt;a href="http://stackoverflow.com/a/5484319/495558."&gt;http://stackoverflow.com/a/5484319/495558.&lt;/a&gt; The &lt;code&gt;ConverterUtil&lt;/code&gt; calls &lt;code&gt;Class.forName&lt;/code&gt; to instantiate your class at runtime but it may not work because your class is usually loaded by PMV &lt;code&gt;ClassLoader&lt;/code&gt;. So putting the custom converter class in the &lt;code&gt;webapps/WEB-INF&lt;/code&gt; enables it to be loaded.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2nd approach&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Long time ago, our project also have a similar issue when we want to control the format of &lt;code&gt;Date&lt;/code&gt; generating by &lt;code&gt;axis2&lt;/code&gt;. After creating the custom class, before each WebService step, we invoke:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;java.lang.reflect.Field isCustomClassPresentField = org.apache.axis2.databinding.utils.ConverterUtil.class
        .getDeclaredField("isCustomClassPresent");
isCustomClassPresentField.setAccessible(true);
isCustomClassPresentField.setBoolean(null, true);
isCustomClassPresentField.setAccessible(false);
java.lang.reflect.Field customClassField = org.apache.axis2.databinding.utils.ConverterUtil.class
        .getDeclaredField("customClass");
customClassField.setAccessible(true);
customClassField.set(null, ConvertDateWithoutTimeZone.class);
customClassField.setAccessible(false);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The idea is to replace the field &lt;code&gt;isCustomClassPresent&lt;/code&gt; and the &lt;code&gt;customClass&lt;/code&gt; using Reflection instead of using system property approach.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Genzer Hawker</dc:creator><pubDate>Tue, 30 Aug 2016 02:27:12 -0400</pubDate><guid>https://answers.axonivy.com/questions/1952/axis2-date-converter/1999</guid></item></channel></rss>