Hello everibody;

In my program, i send a file @ /postXML from a client class using
HttpClient and PostMethod objects. At server side, I have 2 String
objects to return (one with data queried, the second with debug data,
both are necessary) in a List<String> object to the client but I have
a problem... Here is the server side code :

        [...]
        @POST
        @Path("/postXML")
        public Response postXML(InputStream fileContent) {

                List<String> results = this.getX2dbiResults(fileContent);
                Response resp = Response.ok(results).build();

                return resp;
        }
        [...]

At client side, the code is :

                [...]
                RequestEntity entity = new FileRequestEntity(input, "text/xml");
                PostMethod post = new 
PostMethod("http://localhost:9000/postXML";);
                post.addRequestHeader("Accept", "text/xml");
                post.setRequestEntity(entity);

                HttpClient httpclient = new HttpClient();

                try {
                        int result = httpclient.executeMethod(post);
                        System.out.println("Response status code: " + result);
                        System.out.println("Response body: ");
                        System.out.println(post.getResponseBodyAsString());
                }
                finally {
                        post.releaseConnection();
                }
                [...]

When i execute client class, I get this message :

        Response status code: 500
        Response body:
        .No message body writer found for response class : ArrayList.

At server side, I have this information :
        20 avr. 2009 18:37:16
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor
writeResponseErrorMessage
        .No message body writer found for response class : ArrayList.

When I use a String for the result in Response.ok(results).build(),
there is no error, so how is it possible to return another entity than
String (i.e. an ArrayList) into Response.ok().build() ?

Thanks for all.

-- 
Raphaël F.

L'avenir de nos Libertés Fondamentales passe par la défense de nos
Libertés Numériques !
Promouvoir et défendre le logiciel libre : http://www.april.org/
Les projets numériques liberticides du gouvernement français et de
l'Europe : http://www.laquadrature.net/
OpenOffice.org en images : http://www.csdm.qc.ca/sitsat-mtl/openoffice/index.htm
"Ce qu'il y a de scandaleux dans le scandale, c'est qu'on s'y
habitue." Méditez-y...

Reply via email to