You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by londonB <pe...@libero.it> on 2010/07/02 13:39:10 UTC

binding problem with cxf

Hi all,

I've been trying to represent a Json using CXF. The actual piece of Json
looks like the example below :

[CODE]
.
.
.
 "example":{
                     "key":"test1",
                     "value":"test2"
                  },
.
.
.
[/CODE]

The problem is that I would like to represent the above example like the
following:

[CODE]
.
.
.
 "example":{
                     "test1":"test2",                 
                  },
.
.
.
[/CODE]

where "test1" and "test2" are respectively the two properties "key" and
"value" which I had defined in the bean.
I dont know how populate the two properties in order to obtain a result like
the second example above.
Does anyone know how can I do it? I'm out of ideas.

Thank you very much.



-- 
View this message in context: http://old.nabble.com/binding-problem-with-cxf-tp29055326p29055326.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: binding problem with cxf

Posted by Daniel Kulp <dk...@apache.org>.
I honestly cannot think of any "easy" way to do this short of using the 
xml:anyAttribute type things to have a map of attributes on the JAXB types and 
fill those in.   Kind of crappy.

The only other way I can think of is to write a XMLStreamWriter that would 
wrapper the other and trap the "key" and "value" elements and not pass them up 
as is and remap them.

Dan

On Friday 02 July 2010 7:39:10 am londonB wrote:
> Hi all,
> 
> I've been trying to represent a Json using CXF. The actual piece of Json
> looks like the example below :
> 
> [CODE]
> .
> .
> .
>  "example":{
>                      "key":"test1",
>                      "value":"test2"
>                   },
> .
> .
> .
> [/CODE]
> 
> The problem is that I would like to represent the above example like the
> following:
> 
> [CODE]
> .
> .
> .
>  "example":{
>                      "test1":"test2",
>                   },
> .
> .
> .
> [/CODE]
> 
> where "test1" and "test2" are respectively the two properties "key" and
> "value" which I had defined in the bean.
> I dont know how populate the two properties in order to obtain a result
> like the second example above.
> Does anyone know how can I do it? I'm out of ideas.
> 
> Thank you very much.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog