I'm running into problems getting a Date
(java.util.Date
) object back from a ksoap2
response. Here is the response XML:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header></s:Header>
<s:Body>
<UpdateLocationResponse xmlns="http://tempuri.org/">
<UpdateLocationResult>2012-05-07T13:34:34.7693883-04:00</UpdateLocationResult>
</UpdateLocationResponse>
</s:Body>
</s:Envelope>
Here is the code I'm using to initialize the envelope and the request (** are used instead of real names due to security reasons):
static final String NAMESPACE = "http://tempuri.org/";
static final String URL = "http://****************.svc";
envelope.addMapping(NAMESPACE, "UpdateLocationResult", Date.class,
new MarshalDate());
MarshalDate mdate = new MarshalDate();
mdate.register(envelope);
envelope.implicitTypes = true;
HttpTransportSE trans = new HttpTransportSE(URL);
trans.debug = true;
trans.call(SOAP_ACTION, envelope);
Object r = envelope.getResponse(); // r is always SoapPrimitive!!!
// I want it to be a java.util.Date
I've tried all the combinations of namespaces, property names, and marshallers, to no avail. I always get a SoapPrimitive
back from envelope.getResponse()
What am I doing wrong?