質問

Given the following xsd fragment:

<simpleType name="ConsentDateType">
    <restriction base="date">
        <minInclusive value="2000-01-01Z" />
    </restriction>
</simpleType>

I find that WSDL2Java (1.6.2) is producing XMLGregorianCalendar instances to hold the dates. By itself this is not a problem, but when the fields are serialized to XML the time is included as well. And this is indeed a problem, since the XML is used in a SOAP request, which is rejected because a field containing both a date and a time does not follow the formal xsd:date requirements (only a date and a timezone offset is allowed).

What can I do to get around this problem?

-Michael

役に立ちましたか?

解決

I found the answer here:

Java parsing XML date - exclude time

Solution is to create XMLGregorianCalendarDate objects. They will be serialized correctly.

-Michael

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top