Back again...
So I am deploying a webapp that makes use of the Jersey Client to call another webapp (deployed in a different glassfish domain) that has the JAXB/Rest stuff that works. I am using the same "common" jaxb generated classes on both the server side and the "client" side webapp.
My use of jersey client is as follows:
Client client = Client.create();
WebResource r = client.resource("
http://localhost:8081/myapp/myresource");
MyJaxBGeneratedClass a = null;
try {
a = r.header("Content-Type", "application/xml").accept("application/xml").get(MyJaxBGeneratedClass.class);
} catch (UniformInterfaceException uie) {
uie.printStackTrace(System.out);
}
When I hit the page that calls that bit of code, it does make it across to the other domain REST server app. The response from that call does return XML as I tested it with the RestClient swing app, and it works fine. The error I am getting is:
com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java type, class com.company.MyJaxBGeneratedClass, and MIME media type, application/xml, was not found
So, being that these are JAXB generated classes, and I thought I had read that the Jersey Client works much like the Jersey JAXB stuff I got working on the server side piece, what am I missing? Do I need to do some JAXB code to get the response back into the MyJaxBGeneratedClass so that I can use the object? I figured it would be as easy/nice as the server side, where I don't need to do any JAXB code at all, it's done via the Jersey engine.
Can't seem to find any good info on how to do this with regards to Jersey client, JAXB generated classes that are "shared" between the client and the server jersey app the client makes use of.
Thanks for any help.