【问题标题】:Exception communicating with endpoint与端点通信的异常
【发布时间】:2020-02-25 08:01:01
【问题描述】:

我正在实现一个将使用 RESTful Web 服务公开的应用程序。此应用程序将首先使用 RESTful Web 服务来获取 JSON 文件,并将此 JSON 文件返回给请求者(将使用我的服务的应用程序)。我在使用网络服务时遇到问题。

错误:

org.apache.camel.component.restlet.RestletOperationException: Restlet 操作调用 https:// 失败 statusCode: 1001 /n responseBody:HTTPS/1.1 - 通信错误 (1001) - 连接器未能完成与服务器的通信

在 org.apache.camel.component.restlet.RestletProducer.populateRestletProducerException(RestletProducer.java:233)

代码:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
  <camelContext id="camelcontext" xmlns="http://camel.apache.org/schema/spring">
  <restConfiguration component="restlet" port="9091"/>

    <rest path="/say">
        <get uri="/hello" consumes="application/json" produces="application/json">
            <to uri="direct:hello" />
        </get>
    </rest>

    <route>
        <from uri="direct:hello"/>
        <to uri="restlet:https:// <--URL--> ?restletMethod=POST" />
    </route>
</camelContext>
</beans>

【问题讨论】:

  • 您是否一直在使用 Restlet 组件? Camel 3.x 已弃用 Restlet,因此您最好使用另一个组件,例如 servlet(用于提供 REST 服务)和 http(用于使用外部服务)。

标签: rest apache-camel restlet


【解决方案1】:

可能传入的请求有额外的标头,例如在这个问题Apache camel jetty RestletOperationException on invoking request 1001 when mocked restlet endpoint(“org.restlet.http.headers”)中。您可以检查并从请求中删除不必要的标头。另外,由于同样的原因,响应时可能会发生错误,请检查我们的服务是否设置了标头。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-02
    • 2011-10-17
    • 2010-11-12
    • 1970-01-01
    • 2023-03-23
    • 1970-01-01
    相关资源
    最近更新 更多