0

I'm a rookie in Apache Camel and have a ApiRest for consume, and the response it's with gzip, I try this and it not work.

from("timer:aTimer?fixedRate=true&period=200s")
    .doTry()
    .setHeader(Exchange.HTTP_METHOD, constant("GET"))
    .to("http4://" + ReaderXmlVenta.URL_VENTA)
    .marshal(xmlJsonFormat)
    .process("camelProcessor")
    .to(routeMongo)
    .to("log:org.apache.camel.example?level=DEBUG")
    .to("log:Ok:Se guardo un registro Venta fija")
    .doCatch(IllegalArgumentException.class);

And the exception is

Caused by: [java.util.zip.ZipException - Not in GZIP format] java.util.zip.ZipException: Not in GZIP format

The headers:

  • Content-type -> text/xml;charset=utf-8
  • Content-encoding -> gzip
Yeti
  • 1,108
  • 19
  • 28
  • This sounds confusing. You write you get a ZIP response from the HTTP service, but the error message is `Not in GZIP format`. Where exactly is the error thrown? During HTTP request/response or when you try to convert the response to JSON? – burki May 01 '18 at 06:25
  • please provide more details about the exception. Please take a closer look where it happened. Maybe this link will help you: https://stackoverflow.com/questions/14466840/java-error-creating-a-gzipinputstream-not-in-gzip-format – Rostislav V May 01 '18 at 19:42
  • I realized, the issue is in headers "transfer-encoding" -> chunked ¿Do you know if is it the issue? – Franco Aronne May 01 '18 at 22:34
  • It sounds to me like the HTTP service is sending the response (or parts of it) not in zip format despite it says in the headers it does. Therefore the exception is raised by the http client. Can you switch to another HTTP service just to test if it works with another? – burki May 02 '18 at 05:17
  • Verify what you are receiving use another tool first like Postman. – Souciance Eqdam Rashti May 02 '18 at 06:04
  • Burki, thanks for your response. I try with another http and works. links with headers, info by postman : https://ibb.co/k2e3W7 – Franco Aronne May 02 '18 at 15:03
  • I have the next Exception : `Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null], CaughtExceptionType: java.lang.IllegalArgumentException, CaughtExceptionMessage: Invalid uri: http:/PN/genericQueryXMLall.jsp?_from_time=1520564400000&_to_time=1520650740000` – Franco Aronne May 02 '18 at 19:07
  • As the message says, the URI `http:/PN/genericQueryXMLall.jsp?_from_time=1520564400000&_to_time=1520650740000` is invalid. There is only one `/` after `http` and I don't know if `PN` is a hostname – burki May 03 '18 at 07:59
  • I send de uri from envirovment variables. And the uri it's very long. Do you know if it's a problem? The uri it's correct. I try with curl and work externaly of project – Franco Aronne May 03 '18 at 13:27
  • I close this question. I don't hace solution because the URI is blocked for the server. Thanks at alls for your time and responses. – Franco Aronne May 05 '18 at 02:43
  • Can you help me with new issue? https://stackoverflow.com/questions/50185303/camel-http4-with-ssl-self-signed – Franco Aronne May 05 '18 at 19:39

0 Answers0