You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Simone Maletta <si...@alice.it> on 2008/04/25 13:04:07 UTC
return null values
Hi guys,
I'm using ServiceMix 3.1.2 and its jsr181 to deploy my own ws-annotated pojo.
I need to return null values in my code, I'm using an example to be clear:
here is my return type object:
class returnType
{
String h;
Integer i;
}
and this is my code:
p=new returnType();
p.h="goofy";
p.i=null;
and here is the generated response message:
<returnType>
<h>goofy</h>
<returnType>
while I need
<returnType>
<h>goofy</h>
<i/>
<returnType>
there is a way to achive this??
I forget returnType is annotated too.
Thank you all,
regards
Simone
<returnType>
Re: return null values
Posted by Simone Maletta <si...@alice.it>.
Hi Guillaume,
i is an Integer, not a String than I can't set
p.i="";
because I'll have a compiling a exception.
Any other?
----- Original Message -----
From: "Guillaume Nodet" <gn...@gmail.com>
To: <us...@servicemix.apache.org>
Sent: Friday, April 25, 2008 1:20 PM
Subject: Re: return null values
> What if you set
> p.i = "";
> This should give you an empty element, but remember that in xml, <i/>
> and <i></i> are exactly the same, so you won't be able to do any
> difference using that.
> I guess you could expect
> <i xsi:nil="true" />
> or something like that. It may require a nillable annotation on the i
> field or something like that. If you use jaxb2, you'd better try
> finding some info there.
>
> On Fri, Apr 25, 2008 at 1:04 PM, Simone Maletta <si...@alice.it>
> wrote:
>> Hi guys,
>> I'm using ServiceMix 3.1.2 and its jsr181 to deploy my own
>> ws-annotated pojo.
>> I need to return null values in my code, I'm using an example to be
>> clear:
>> here is my return type object:
>> class returnType
>> {
>> String h;
>> Integer i;
>> }
>>
>> and this is my code:
>> p=new returnType();
>> p.h="goofy";
>> p.i=null;
>> and here is the generated response message:
>> <returnType>
>> <h>goofy</h>
>> <returnType>
>>
>> while I need
>>
>> <returnType>
>> <h>goofy</h>
>> <i/>
>> <returnType>
>>
>> there is a way to achive this??
>> I forget returnType is annotated too.
>>
>> Thank you all,
>> regards
>> Simone
>> <returnType>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
Re: return null values
Posted by Simone Maletta <si...@alice.it>.
Hi Guillaume,
I solved, I annoted each element of the return tye in thsis way:
@XMLELement(nillable=true)
thank you
regards
Simone
----- Original Message -----
From: "Guillaume Nodet" <gn...@gmail.com>
To: <us...@servicemix.apache.org>
Sent: Friday, April 25, 2008 1:20 PM
Subject: Re: return null values
> What if you set
> p.i = "";
> This should give you an empty element, but remember that in xml, <i/>
> and <i></i> are exactly the same, so you won't be able to do any
> difference using that.
> I guess you could expect
> <i xsi:nil="true" />
> or something like that. It may require a nillable annotation on the i
> field or something like that. If you use jaxb2, you'd better try
> finding some info there.
>
> On Fri, Apr 25, 2008 at 1:04 PM, Simone Maletta <si...@alice.it>
> wrote:
>> Hi guys,
>> I'm using ServiceMix 3.1.2 and its jsr181 to deploy my own
>> ws-annotated pojo.
>> I need to return null values in my code, I'm using an example to be
>> clear:
>> here is my return type object:
>> class returnType
>> {
>> String h;
>> Integer i;
>> }
>>
>> and this is my code:
>> p=new returnType();
>> p.h="goofy";
>> p.i=null;
>> and here is the generated response message:
>> <returnType>
>> <h>goofy</h>
>> <returnType>
>>
>> while I need
>>
>> <returnType>
>> <h>goofy</h>
>> <i/>
>> <returnType>
>>
>> there is a way to achive this??
>> I forget returnType is annotated too.
>>
>> Thank you all,
>> regards
>> Simone
>> <returnType>
>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
Re: return null values
Posted by Guillaume Nodet <gn...@gmail.com>.
What if you set
p.i = "";
This should give you an empty element, but remember that in xml, <i/>
and <i></i> are exactly the same, so you won't be able to do any
difference using that.
I guess you could expect
<i xsi:nil="true" />
or something like that. It may require a nillable annotation on the i
field or something like that. If you use jaxb2, you'd better try
finding some info there.
On Fri, Apr 25, 2008 at 1:04 PM, Simone Maletta <si...@alice.it> wrote:
> Hi guys,
> I'm using ServiceMix 3.1.2 and its jsr181 to deploy my own ws-annotated pojo.
> I need to return null values in my code, I'm using an example to be clear:
> here is my return type object:
> class returnType
> {
> String h;
> Integer i;
> }
>
> and this is my code:
> p=new returnType();
> p.h="goofy";
> p.i=null;
> and here is the generated response message:
> <returnType>
> <h>goofy</h>
> <returnType>
>
> while I need
>
> <returnType>
> <h>goofy</h>
> <i/>
> <returnType>
>
> there is a way to achive this??
> I forget returnType is annotated too.
>
> Thank you all,
> regards
> Simone
> <returnType>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/