Hi Guy
On 07/12/11 14:49, Guy Pardon wrote:
Hi,
I want to test a JAXRS client calling a REST service with json encoding. The service is
configured with "dropRootElement" and now the client fails because it expects
the root element there.
How can I tell the client proxy to stop looking for the root element?
The client is about to deserialize a payload into a bean so it needs a
root. With the default JSON provider you can probably do it like this:
JSONProvder provider = new JSONProvider();
provider.setSupportUnwrapped(true);
JAXRSClientFactory.create(MyProxy.class,
Collections.singletonList(provider));
That should do; provider.setWrapperName which accepts Qnames in expanded
form ("root" or "{mynamespace}root") can be used to further customize
the custom root element.
Alternatively try the Jackson provider and see if it can get the
root-less data payload read into a bean
Give that a try please
Cheers, Sergey
Thanks
Guy