rest - 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>
解决方案
可能传入的请求有额外的标头,例如在这个问题中,Apache camel jetty RestletOperationException on invoking request 1001 when mocked restlet 端点(“org.restlet.http.headers”)。您可以检查并从请求中删除不必要的标头。此外,由于同样的原因,响应时可能会发生错误,请检查我们的服务是否设置了标头。
推荐阅读
- plsql - 根据条件从 JSON 获取值
- java - AADSTS65001:用户或管理员未同意使用带有 ID 的应用程序
- java - 如何使用opencv在android java中获取带有统计信息的connectedComponents以及如何使用这些统计信息来获取左点、右品脱、质心、面积等
- assembly - 向 MIPS 添加新指令
- scrapy - 如何在 n 个失败的请求后告诉蜘蛛停止请求?
- javascript - 如何通过 React jsx 执行包含多个函数的 .js 文件
- javascript - 将状态传递给我的 useState 挂钩后,它是未定义的,为什么?
- javascript - 使用 Java Script fetch 命令从 google chrome 控制台请求新闻 API 运行命令时出现问题
- python - keras.engine.training.Model.compile() 参数 --loss = dice_loss -- metric= dice_loss 不一样
- algorithm - 我可以在没有固定或可变表的情况下进行霍夫曼编码吗