Hi,

I'm using Apache Wink 1.1 in a Websphere Environment and an exception from the following client code:

// Server:
@Path("/jobs")
@Consumes(value = MediaType.TEXT_XML)
@Produces(value = MediaType.TEXT_XML)
public class ConfigJobs {

private static final Logger LOG = Logger.getLogger(ConfigJobs.class.getName());

        private WasAdminWSService service;

        public ConfigJobs() {
                //...
        }

        @GET
        @Path(value = "forCell/{cell}")
        @Produces({ MediaType.TEXT_XML })
public Job getNextConfigJob(@PathParam(value = "cell") String cell) throws DatatypeConfigurationException {
                // service may return null
                return service.getNextJob(new CellName(cell));
        }
}


// Client:
public ConfigJob getConfigJob() {
        String relPath = "jobs/forCell/" + config.getCellName();
        Resource resource = webResourceFactory.createNewInstance(relPath);

//next line results in Exception
ConfigJob configJob = resource.accept(MediaType.TEXT_XML).get(ConfigJob.class);

        if (configJob != null && configJob.getCellName() != null) {
                LOG.fine("found a job");
        }

        return configJob;
}



// Exception:

Mar 10, 2014 1:21:49 PM.700 INFO MessageDispatcher.getConfigJob(): GET jobs/forCell/abc java.lang.RuntimeException: A javax.ws.rs.ext.MessageBodyReader implementation was not found for class bla.wasadmin.wsdata.ConfigJob type and application/octet-stream media type. Verify that all entity providers are correctly registered. Add a custom javax.ws.rs.ext.MessageBodyReader provider to handle the type and media type if a JAX-RS entity provider does not currently exist. at org.apache.wink.client.internal.handlers.ClientResponseImpl.readEntity(ClientResponseImpl.java:134) at org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:76) at org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:63) at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:196) at org.apache.wink.client.internal.ResourceImpl.get(ResourceImpl.java:302) at bla.wasadmin.impl.MessageDispatcher.getConfigJob(MessageDispatcher.java:36)
        at bla.wasadmin.jmx.job.JobRunnerTask.task(JobRunnerTask.java:55)
        at bla.wasadmin.jmx.job.JobRunnerTask.run(JobRunnerTask.java:91)
        at java.util.Timer$TimerImpl.run(Timer.java:296)

Actually, I'd expect to get null to the server instead of this Error. Is there a failure in my understanding of writing JAX-RS webservice with wink?

Is there a possibility to get null to the server?

Thank's for helping in advance,

Christian

Reply via email to