You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2011/11/13 02:00:56 UTC

Some debugging woes with JAX-RS + Jackson

I'm trying to use a provider for the first time on the client side of
JAX-RS, using CXF 2.5.0.

Here's the code to set up the client:

        List<Object> providers = new ArrayList<Object>();
        providers.add(new org.codehaus.jackson.jaxrs.JacksonJsonProvider());
        WebClient client = WebClient.create("http://localhost:" +
portString + "/r4dws/services/doc", providers);
        client.type("application/json");
        PlainTextInputOptions ptio = new PlainTextInputOptions();
        // details of the content bean elided
        Response response =
client.path("/processText").accept("application/json").invoke("GET",
ptio);

The output logging interceptor shows the right thing (a bunch of json)
in the 'Payload'

Http-Method: GET
Content-Type: application/json
Headers: {Content-Type=[application/json], Accept=[application/json]}
Payload: {"languageDetection":{"language":"UNKNOWN","strategy":"MULTIPLE"},"text":"1
de junio de 2003, 18h01\n\nBush y Chirac sonríen para las cámaras en
tensa cumbre del G-8\n\n\nEVIAN, Francia (Reuters) - Los presidentes
George W. Bush y Jacques Chirac sonrieron el domingo para las cámaras
al inicio de una cumbre del Grupo de los Ocho eclipsada por el
enfrentamiento franco-estadounidense por la guerra de Irak y la
inquietud sobre los próximos movimientos de Washington.\n\n\nBush
recibió un corto ..."}

But the input logging interceptor shows absolutely nothing:

----------------------------
ID: 2
Address: http://localhost:15000/r4dws/services/doc/processText
Http-Method: GET
Content-Type: application/json
Headers: {Accept=[application/json], cache-control=[no-cache],
connection=[keep-alive], content-type=[application/json],
host=[localhost:15000], pragma=[no-cache], user-agent=[Apache CXF
2.5.0]}
--------------------------------------

Where has my json gone? The choice of GET over POST here is a
conceptual error which I'll fix, but shouldn't work just the same?

Re: Some debugging woes with JAX-RS + Jackson

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Benson, can you provide more info please ?

Where do you have the logging interceptors registered ? Assuming it is 
on the client side, can you please confirm using a tcp trace utility, 
that the response payload is actually non-empty ?

Cheers, Sergey

On 13/11/11 01:00, Benson Margulies wrote:
> I'm trying to use a provider for the first time on the client side of
> JAX-RS, using CXF 2.5.0.
>
> Here's the code to set up the client:
>
>          List<Object>  providers = new ArrayList<Object>();
>          providers.add(new org.codehaus.jackson.jaxrs.JacksonJsonProvider());
>          WebClient client = WebClient.create("http://localhost:" +
> portString + "/r4dws/services/doc", providers);
>          client.type("application/json");
>          PlainTextInputOptions ptio = new PlainTextInputOptions();
>          // details of the content bean elided
>          Response response =
> client.path("/processText").accept("application/json").invoke("GET",
> ptio);
>
> The output logging interceptor shows the right thing (a bunch of json)
> in the 'Payload'
>
> Http-Method: GET
> Content-Type: application/json
> Headers: {Content-Type=[application/json], Accept=[application/json]}
> Payload: {"languageDetection":{"language":"UNKNOWN","strategy":"MULTIPLE"},"text":"1
> de junio de 2003, 18h01\n\nBush y Chirac sonríen para las cámaras en
> tensa cumbre del G-8\n\n\nEVIAN, Francia (Reuters) - Los presidentes
> George W. Bush y Jacques Chirac sonrieron el domingo para las cámaras
> al inicio de una cumbre del Grupo de los Ocho eclipsada por el
> enfrentamiento franco-estadounidense por la guerra de Irak y la
> inquietud sobre los próximos movimientos de Washington.\n\n\nBush
> recibió un corto ..."}
>
> But the input logging interceptor shows absolutely nothing:
>
> ----------------------------
> ID: 2
> Address: http://localhost:15000/r4dws/services/doc/processText
> Http-Method: GET
> Content-Type: application/json
> Headers: {Accept=[application/json], cache-control=[no-cache],
> connection=[keep-alive], content-type=[application/json],
> host=[localhost:15000], pragma=[no-cache], user-agent=[Apache CXF
> 2.5.0]}
> --------------------------------------
>
> Where has my json gone? The choice of GET over POST here is a
> conceptual error which I'll fix, but shouldn't work just the same?