Jakub Podlesak wrote:
> Hi Rob,
>
> please see in line...
>
> Rob - wrote:
>> Hi,
>>
>> I'm integrating Jersey(server) with a WCF(client) and an issue when
>> passing a Java HashMap<String,String> from the server to the client.
>>
>> Basically Jersey generates the following for a Map<String,String>
>
> Jersey does not provide a writer for this out-of-the box, how did you
> configure?
BTW. Jackson has a built-in support for the Maps, so you should be able
to utilize that.
There is a Jersey example showing how to switch the Jackson support on
at [1],
HTH,
~Jakub
[1]
http://download.java.net/maven/2/com/sun/jersey/samples/jacksonjsonprovider/1.1.5.1/jacksonjsonprovider-1.1.5.1-project.zip
>
>>
>> {Map:{"entry",{"key":"key1","value":"value1"},"entry",{"key":"key2","value":"value2"},"entry",{"key":"key3","value":"value3"}.....}}
>
> This is not a valid JSON, the Map is not quoted, then after the first
> "entry", there should be a colon instead of the comma, etc.
>>
>> unfortunately, at the other side of the wire, WCF expects something
>> more like:
>>
>> {Map:{"key":"key1","value":"value1"},{"key":"key2","value":"value2"},{"key":"key3","value":"value3"}.....}
>
> Neither this is a valid JSON. Maybe you just need to write your own
> message body writer for the Map<String, String> [1],
> but then i would advise you not to use the the JSON media type for
> what you generate out of it.
>
> HTH,
>
> ~Jakub
>
> [1]https://jsr311.dev.java.net/nonav/releases/1.1/javax/ws/rs/ext/MessageBodyWriter.html
>>
>> I've already tried changing WCF to deserialize the Jersey generated
>> response but to no avail (does not work and it's overly complicated).
>>
>> So, how can I customize the way JAXB spits Json so it can generate
>> what WCF expects?
>>
>> Any pointers/ideas/snippets/etc are very much appreciated.
>>
>> Cheers
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>> Meet local singles online. Browse profiles for FREE!
>> <http://clk.atdmt.com/NMN/go/150855801/direct/01/>
>