Hi,
I have set up a CXF JAX-RS Server which works fine. Among other services, it
has one that returns a Map when invoked, and it's implemented like this:
@Path("/lqservice/")
@Produces("application/json")
public interface LiqService {
@GET
@Produces("multipart/mixed")
@Path("/liq/{id}/{v}")
Map<String, Object> getLiq(@PathParam("") Solic solicRequest);
}
public class LiqServiceImpl implements LiqService {
public Map<String, Object> getLiq(Solic solicRequest) {
Map<String, Object> response = ...;
...
return response;
}
}
When I invoke the service using cURL I get a correct multipart message:
C:\>curl http://localhost:8181/cxf/es/lqservice/liq/C1/1
--uuid:54ef3462-a04a-4620-bf06-7d7e84a30c13
Content-Type: text/xml; charset=UTF-8; type="application/zip";
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>
...
--uuid:54ef3462-a04a-4620-bf06-7d7e84a30c13
Content-Type: application/json
Content-Transfer-Encoding: binary
Content-ID: <1>
...
--uuid:54ef3462-a04a-4620-bf06-7d7e84a30c13-
So I guess the service it's OK.
The problem comes in the client. I'm using a proxy which I set up like this:
List<AbstractJAXBProvider> providers = new ArrayList<AbstractJAXBProvider>();
JSONProvider jsonProvider = new JSONProvider();
jsonProvider.setConvention("badgerfish");
providers.add(jsonProvider);
client = JAXRSClientFactory.create("http://localhost:8181/cxf/es",
LiquidacionesService.class, providers);
And when I invoke the service like:
Map<String, Object> map = client.getLiq(solicRequest));
I get NULL.
I've tried using WebClient and I get a Response but I'd prefer using the proxy.
Is there any problem between proxies and maps or multiparts?
Why does the proxy decide to discard the response if it does so? (Binding
problem?)
Which is the correct way to return a Map from a service?
Any help would be appreciated. Thanks in advance.
BR,
Marcos