the phantom
Newbie
Hi all,
Built a simple app a while back and part of it needed to pass a date value to a web service. For some reason simply passing the web service a string wouldn't do so I had to apparently Marshal the date and register the envelope that is given to the SOAP request. I found a suitable example on line and applied it to my app and it worked. However for some reason the time on the values that is passed is an hour early ? Is this likely to be something to do with a locale setting in the marshal class? I'm not sure what to change..?
Do below;
public
class MarshalDate implements Marshal
{
public Object readInstance(XmlPullParser parser, String namespace, String name,
PropertyInfo expected)
throws IOException, XmlPullParserException {
return IsoDate.stringToDate(parser.nextText(), IsoDate.DATE_TIME );
}
public void register(SoapSerializationEnvelope cm) {
cm.addMapping(cm.
xsd, "DateTime", Date.class, this);
}
public void writeInstance(XmlSerializer writer, Object obj) throws IOException {
writer.text(IsoDate.dateToString((Date) obj, IsoDate.
DATE_TIME));
}
}
Built a simple app a while back and part of it needed to pass a date value to a web service. For some reason simply passing the web service a string wouldn't do so I had to apparently Marshal the date and register the envelope that is given to the SOAP request. I found a suitable example on line and applied it to my app and it worked. However for some reason the time on the values that is passed is an hour early ? Is this likely to be something to do with a locale setting in the marshal class? I'm not sure what to change..?
Do below;
public
class MarshalDate implements Marshal
{
public Object readInstance(XmlPullParser parser, String namespace, String name,
PropertyInfo expected)
throws IOException, XmlPullParserException {
return IsoDate.stringToDate(parser.nextText(), IsoDate.DATE_TIME );
}
public void register(SoapSerializationEnvelope cm) {
cm.addMapping(cm.
xsd, "DateTime", Date.class, this);
}
public void writeInstance(XmlSerializer writer, Object obj) throws IOException {
writer.text(IsoDate.dateToString((Date) obj, IsoDate.
DATE_TIME));
}
}