You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mike Noordermeer <mi...@normi.net> on 2010/07/23 14:43:17 UTC

Aegis, setDefaultNillable() and null return

Hi,

I'm using CXF with Aegis databinding and a CXFNonSpringServlet. My SEI 
and some parts of the data classes are annotated using JAXB annotations.

I use the following Aegis type config:

         tOpts.setDefaultNillable(false);
         tOpts.setDefaultMinOccurs(1);

But when I set these options, I can't return nil from my webservice 
methods anymore. Does anyone know if there is an annotation I can set to 
allow null/nil returns from a service method?

-- 
Regards,

Mike Noordermeer
mike@normi.net

Re: Aegis, setDefaultNillable() and null return

Posted by Benson Margulies <bi...@gmail.com>.
File a JIRA? Possibly fairly quickly fixable.

On Wed, Jul 28, 2010 at 4:24 AM, Mike Noordermeer <mi...@normi.net> wrote:
> Hi,
>
> Benson Margulies wrote:
>>
>> In theory, with a WHATEVER.aegis.xml file. I don't see a unit test
>> that does this, so feel free to squawk if it doesn't work.
>>
>> <mappings>
>>        <mapping>
>>                <method name="getMapLongToString">
>>                        <return-type nillable="true" />
>>                </method>
>>        </mapping>
>> </mappings>
>
> Thanks, doesn't seem to work though :-(
>
> Aegis finds the mapping file:
>
> 2596 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] TRACE
> org.apache.cxf.aegis.type.XMLTypeCreator  - Found mapping file :
> /nl/eveoh/scheduleviewer/services/UserPreferencesService.aegis.xml
>
> But it doesn't return a null value, it returns:
>
>      <ns1:getUserPrefsResponse
> xmlns:ns1="http://services.scheduleviewer.eveoh.nl/"/>
>
> instead of:
>
>      <ns1:getUserPrefsResponse ns2:nil="true"
> xmlns:ns1="http://services.scheduleviewer.eveoh.nl/"
> xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance"/>
>
> Any ideas? If not I guess I'll have to not use setDefaultNillable(false) and
> just tag everything that's non-nillable.
>
> --
> Regards,
>
> Mike Noordermeer
> mike@normi.net
>

Re: Aegis, setDefaultNillable() and null return

Posted by Mike Noordermeer <mi...@normi.net>.
Hi,

Benson Margulies wrote:
> In theory, with a WHATEVER.aegis.xml file. I don't see a unit test
> that does this, so feel free to squawk if it doesn't work.
> 
> <mappings>
>         <mapping>
>                 <method name="getMapLongToString">
>                         <return-type nillable="true" />
>                 </method>
>         </mapping>
> </mappings>

Thanks, doesn't seem to work though :-(

Aegis finds the mapping file:

2596 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] TRACE 
org.apache.cxf.aegis.type.XMLTypeCreator  - Found mapping file : 
/nl/eveoh/scheduleviewer/services/UserPreferencesService.aegis.xml

But it doesn't return a null value, it returns:

       <ns1:getUserPrefsResponse 
xmlns:ns1="http://services.scheduleviewer.eveoh.nl/"/>

instead of:

       <ns1:getUserPrefsResponse ns2:nil="true" 
xmlns:ns1="http://services.scheduleviewer.eveoh.nl/" 
xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance"/>

Any ideas? If not I guess I'll have to not use setDefaultNillable(false) 
and just tag everything that's non-nillable.

-- 
Regards,

Mike Noordermeer
mike@normi.net

Re: Aegis, setDefaultNillable() and null return

Posted by Benson Margulies <bi...@gmail.com>.
In theory, with a WHATEVER.aegis.xml file. I don't see a unit test
that does this, so feel free to squawk if it doesn't work.

<mappings>
        <mapping>
                <method name="getMapLongToString">
                        <return-type nillable="true" />
                </method>
        </mapping>
</mappings>




On Sun, Jul 25, 2010 at 4:06 AM, Mike Noordermeer <mi...@normi.net> wrote:
> Benson Margulies wrote:
>>
>> I think I need a much more detailed test case to make sense of this.
>> However, what you appear to have stated is that, unless you declare a
>> particular item to be nillable, it can't be null.
>
> Thanks for your reply, sorry for the confusion.
>
> The basic question is: how do I declare a return value (of a service method)
> to be nillable when using Aegis?
>
> --
> Regards,
>
> Mike Noordermeer
> mike@normi.net
>

Re: Aegis, setDefaultNillable() and null return

Posted by Mike Noordermeer <mi...@normi.net>.
Benson Margulies wrote:
> I think I need a much more detailed test case to make sense of this.
> However, what you appear to have stated is that, unless you declare a
> particular item to be nillable, it can't be null.

Thanks for your reply, sorry for the confusion.

The basic question is: how do I declare a return value (of a service 
method) to be nillable when using Aegis?

-- 
Regards,

Mike Noordermeer
mike@normi.net

Re: Aegis, setDefaultNillable() and null return

Posted by Benson Margulies <bi...@gmail.com>.
I think I need a much more detailed test case to make sense of this.
However, what you appear to have stated is that, unless you declare a
particular item to be nillable, it can't be null.

On Fri, Jul 23, 2010 at 8:43 AM, Mike Noordermeer <mi...@normi.net> wrote:
> Hi,
>
> I'm using CXF with Aegis databinding and a CXFNonSpringServlet. My SEI and
> some parts of the data classes are annotated using JAXB annotations.
>
> I use the following Aegis type config:
>
>        tOpts.setDefaultNillable(false);
>        tOpts.setDefaultMinOccurs(1);
>
> But when I set these options, I can't return nil from my webservice methods
> anymore. Does anyone know if there is an annotation I can set to allow
> null/nil returns from a service method?
>
> --
> Regards,
>
> Mike Noordermeer
> mike@normi.net
>