骆驼http GET调用状态码406

Camel http GET call Status code 406

我正在尝试使用带有 Spring Boot 的 Camel 进行 GET 调用。当我使用以下代码时,我得到 406 代码。但是,如果我尝试使用邮递员访问端点,我会得到 200 的响应 (json)。请帮忙。

from(RouteUtils.buildSedaEndpointWithConcurrentConsumers("sedaEndpointin", domain.getThreads()))
                    .routeId("routeiD")
                    .setProperty("workerId").jsonpath("$.worker_id")
                    .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET))
                    .setHeader(Exchange.HTTP_QUERY, simple(String.format("key=%s&barcode=${exchangeProperty.workerId}", apiKey)))
                    .setHeader(Exchange.HTTP_URI, simple("https://" + endpoint))
                    .setHeader("Authorization", simple(Auth))
                    .setHeader("Content-Type", constant("application/json"))
                    .to("http4://" + Endpoint)
                    .to("sedaEndpoint");

406 Not Acceptable The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.

您发送的 application/json 似乎未被客户端服务器接受,或者可能是同一端口上的两个不同项目。也检查一下。

也试试这个... setHeader("Content-Type", constant("application/x-www-form-urlencoded")) 我猜。 详细了解状态代码错误 Status Code 406