java - How are date and datetime supposed to be serialized SOAP (xml) messages -
we working on building java client third party soap webservice, have not access or control off server side code. provided wsdl description file of service. using axis 1 (version 1.4 ).
we have run following issue related date vs datetime serialization , deserialization. said wsdl defines 2 types datetime , daterange
<xs:element minoccurs="0" name="datetime" type="xs:datetime"/> <xs:element minoccurs="0" name="daterange"> <xs:complextype> <xs:sequence> <xs:element name="start" type="xs:date"/> <xs:element name="end" type="xs:date"/> </xs:sequence> </xs:complextype> </xs:element>
where xs prefix denotes xml schema, following present
xmlns:xs="http://www.w3.org/2001/xmlschema"
the axis wsdl2java generates java objects whre datetime field type calendar, , start, end fields typed java.util.date
when serialization happens start , end fields serialized yyyy-mm-dd format , example 2014-02-01 when actual call made server side recieve following response
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:header/> <soap-env:body> <soap-env:fault> <faultcode>soap-env:server</faultcode> <faultstring xml:lang="en">jibx unmarshalling exception; nested exception org.jibx.runtime.jibxexception: missing 't' separator in datetime</faultstring> </soap-env:fault> </soap-env:body> </soap-env:envelope>
we used soap ui build request xml payload directly , observed if pass date portion in start , end fields exact same response, while if pass 2 fields time portion datetime field works, gives no fault message.
this when taken gleam xmlschema documentation xs:date , xs:datetime , in particular lexical , canonical representation section, seems imply that
axis based serialization of start , end field yyyy-mm-dd , ignoring time portion correct. , client side code generated conforms wsdl provided us.
server side code not conform wsdl provided us, expects datetime field rather date field.
since date , datetime field required serialized in different formats schema definition. result failure @ server side when attempts de-serialize message
to validate our hypothesis 1. used python's zsi library generate python stub , resulting xml it.
serializes start , end in yyyy-mm-dd format , additional 'z' @ end. again fails deserialized @ server side, though serialization format conforms xs:date defined xml schema
<ns1:start>2014-02-05z</ns1:start>
can confirm if hypothesis formed us, based on observed behaviour, documentation , experiment python's zsi correct. or if missing detail
hm, reason daterange fields start , end, message datetime field requires (as xml schema says) t-separator between date portion , time portion, not space or other char.
please check how serialize datetime field (not start or end fields!). must in format "yyyy-mm-dd't'hh:mm:ss"
.
Comments
Post a Comment