You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by David Sills <DS...@datasourceinc.com> on 2011/08/15 14:06:46 UTC
Null strings
All:
I'm having a peculiar problem and can't seem to find an easy solution
using the CXF documentation. When a value passed via SOAP is empty (say,
the middle name if it's an optional value), the JavaBean is filled in
with an empty string, not null. This conflicts with JSR 303, which
mostly only returns valid values for null strings, at least out of box
(for instance, the Pattern validator in the RI returns true if the value
is null but not if it's an empty string).
Is there a straightforward way to configure the data binding to use null
rather than empty strings? Or do I need to write my own validators to
test for empty strings and throw out the RI exemplars?
David Sills
Re: Null strings
Posted by Daniel Kulp <dk...@apache.org>.
In almost all cases with CXF, it does set it to null. Can you capture the
soap message that is being sent and see what is in there? If there is an
empty element (like "<middleName/>") then it would be an empty string which
would be correct. If the element is missing entirely, it would normally be
null.
Dan
On Monday, August 15, 2011 8:06:46 AM David Sills wrote:
> All:
>
> I'm having a peculiar problem and can't seem to find an easy solution
> using the CXF documentation. When a value passed via SOAP is empty (say,
> the middle name if it's an optional value), the JavaBean is filled in
> with an empty string, not null. This conflicts with JSR 303, which
> mostly only returns valid values for null strings, at least out of box
> (for instance, the Pattern validator in the RI returns true if the value
> is null but not if it's an empty string).
>
> Is there a straightforward way to configure the data binding to use null
> rather than empty strings? Or do I need to write my own validators to
> test for empty strings and throw out the RI exemplars?
>
> David Sills
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com