Hi community!

cxf version being used: 3.1.7

- I'm using cxf as a rest client (Proxy based)
- The server that my client is interacting with returns a 301 (let's
suposse I can't avoid or circunvent that 301 by any way)
- At first, the rest invocation was failing with an exception
- I forced redirects with httpClientPolicy.setAutoRedirect(true) and
everything worked as expected. Hooray!
- But soon I realized that requests following the first one were failing
with 404 Boo Hoo!
- What I can see is that request following the first one are being directed
to a wrong URL
- I suspect that URL is being "constructed" by CXF from the experience
gained after the first redirect (in order to avoid networks round trips)
- Let's see an example:

- First request to
http://x.x.x.x/QNet24/services/rest/api/datosCheque?cbu=4310001322100000003060&cuit=27237145874&cantidad=10&tipo=CPD
- Response 301 Location:
http://x.x.x.x/QNet24/servicesrest/api/datosCheque/?cbu=4310001322100000003060&cuit=27237145874&cantidad=10&tipo=CPD
- The 301 is honored by CXF and then a 200 response is received. Good!

- Second request to the same interface method
- URL used:
http://x.x.x.x/QNet24/servicesrest/api/datosCheque/api/datosCheque?cbu=4310001322100000003060&cbu=4310001322100000003060&cuit=27237145874&cuit=27237145874&cantidad=10&cantidad=10&tipo=CPD&tipo=CPD
- Notice the "double" api/datosCheque and the duplicated query string
parameters.

- Moreover if a invoque the other interface method the URL being used is:
http://x.x.x.x/QNet24/servicesrest/api/datosCheque/api/negociacion?cbu=4310001322100000003060&cuit=27237145874&cantidad=10&tipo=CPD
(instead of http://x.x.x.x/QNet24/servicesrest/api/negociacion)

Here it is my interface

@Path("/api")
@Consumes("application/json")
@Produces("application/json")
public interface BancoService {

@Path("/datosCheque")
@GET
public Response getNumeracion(
@QueryParam("cbu") String cbu,
@QueryParam("cuit") String cuit,
@QueryParam("cantidad") int cantidad,
@QueryParam("tipo") String tipo);

@Path("/negociacion")
@POST
public Response negociacion(NegociacionBanco negociacion);

}

- Is there something I can do to solve this?

- I thought about using apache http client and let it handle the redirect
stuff but looking at the code (AsyncHTTPConduitFactory) I see that a
bogus RedirectStrategy is being used and I'm not being able to figure out
if I could change it (to apache http client DefaultRedirectStrategy for
example) or I'd mess it up doing so.

Thanks in advance!

Regards!

Pablo

Reply via email to