Thanks for the quick reply.

I do have the response construction set up with helper methods and classes
to make it easier to maintain. I also have unit tests around the code doing
the response construction.

I am using the ObjectFactory to construct the nodes that I need rather than
building my own QName and JaxbElement. I am doing this so that a change to
the WSDL will be caught immediately as a compilation error. For example, if
an element gets renamed, the code will fail to compile rather than relying
solely on the tests to detect an error in my QName.

I understand that the JaxbElement is only used when the XSD has two absent
states (minOccurs="0" and nillable="true"). When the minOcurrs="1" or the
nillable="false", the JaxbElement is not used and is not needed as the NULL
check is sufficient to determine the absent state if the request is valid.
>From what I understand the use of the JaxbElement is needed if I need to
differentiate between an optional element that was not provided, an optional
element with a nilled value, and a user-provided value. Is this
understanding correct?

Would you agree that the ObjectFactory is the preferred means of
constructing the JaxbElement if needed rather than managing the QName and
JAXBelement myself?

--
View this message in context: 
http://cxf.547215.n5.nabble.com/working-with-optional-nillable-elements-common-to-request-and-response-tp5159623p5161187.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to