首页 > 解决方案 > Exception communicating with endpoint

问题描述

I am implementing an application which would be exposed using RESTful web service. This application would firstly consume a RESTful web service to get the JSON file and would return this JSON file to the requestor (application which would consume my service). I am facing issues consuming the web service.

ERROR:

org.apache.camel.component.restlet.RestletOperationException: Restlet operation failed invoking https:// <--url--> with statusCode: 1001 /n responseBody:HTTPS/1.1 - Communication Error (1001) - The connector failed to complete the communication with the server

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

CODE:

<?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>

标签: restapache-camelrestlet

解决方案


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


推荐阅读