Details
Description
I have a JAX-RS interface called JobQueueEndpoint with a method like this:
@POST
@Path("job/
")
@Consumes(MediaType.TEXT_XML)
@Produces(
)
JobIdentifierDTO submitJob(@PathParam("queue") String queueName, String jobXml);
I create a client for this API like so:
JobQueueEndpoint resource = JAXRSClientFactory.create(jobQueueUrl, JobQueueEndpoint.class);
and invoke:
resource.submitJob("qFoo", "<job/>");
But I get this:
Jan 26, 2012 8:09:23 PM org.apache.cxf.jaxrs.utils.JAXRSUtils findTargetMethod
WARNING: No operation matching request path "/jobqueue/job/qFoo" is found, Relative Path: /job/qFoo, HTTP Method: POST, ContentType: text/plain, Accept: text/xml,application/json,. Please enable FINE/TRACE log level for more details.
The problem is that the client is sending "text/plain" and the server is expecting "text/xml". I'm guessing that's because the jobXml argument is a String. It seems to me that the client should always use the @Consumes value unless explicitly told otherwise. Perhaps the method should be refactored to take a Document instead of a String, but this problem seems like a bug.
The other methods of this client work fine, so I believe it's not an environmental problem. I've tried to trace the code of WebClient, but I've gotten lost in its complexity...