You can implement a custom adapter that parses your special date format string into a valid date.
package xmlhelper;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.bind.annotation.adapters.XmlAdapter;
public class DateAdapter extends XmlAdapter<String, Date> {
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
@Override
public String marshal(Date v) throws Exception {
return dateFormat.format(v);
}
@Override
public Date unmarshal(String v) throws Exception {
return dateFormat.parse(v);
}
}
To use it in your webservice you have to modify the generated webservice source class. Simply add an `@XmlJavaTypeAdapter` annotation into your method parameter definiton:
@javax.jws.WebMethod
@javax.jws.WebResult(name="result")
public CallResult call(
@javax.jws.WebParam(name="createJavaDataSaved")
@XmlJavaTypeAdapter(DateAdapter.class)
java.util.Date createJavaDataSaved)
throws ch.ivyteam.ivy.webservice.process.restricted.WebServiceProcessTechnicalException
{
...
}
Remember that the generated webservice source will be overwritten whenever you change the mod file of the webservice. So you should at least write a test against your webservice stub so that you get an early warning if the adapter is not in charge anymore.
![alt text][1]
You can inspect a full sample implementation here: [webserviceProviderWithSpecialDateFormat_63.iar][2]
[1]: http://answers.axonivy.com/upfiles/soapUiCallWithSpecialDateFormat.pnghttps://answers.axonivy.com/upfiles/soapUiCallWithSpecialDateFormat.png
[2]: http://developer.axonivy.com/q-and-a-attachments/webserviceProviderWithSpecialDateFormat_63.iar/upfiles/webserviceProviderWithSpecialDateFormat_63.iar