如何通过 Apache Camel 调用 RESTful 服务? [英] How can I invoke a RESTful service through Apache Camel?

查看:63
本文介绍了如何通过 Apache Camel 调用 RESTful 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 HTTP 方法来调用一些会产生 JIRA 问题的 URL.

I am currently using a HTTP method for invoking some URL which will create a JIRA issue.

现在我想使用 Apache Camel,我该如何使用?

Now I want to use Apache Camel, how can I use that?

我需要通过 Camel 调用以下链接:

I need to invoke the following link through Camel:

http://localhost:8080/rest/api/2/project/" + key + /components

因为我是 Camel 的新手,所以也请提出一些解决方案和示例.

As I'm new to Camel, please suggest some solutions and examples too.

谢谢

推荐答案

您可以轻松使用 CXFRS 组件;如果您出于某种原因需要使用 HTTP 组件 来执行此操作,您也可以轻松使用它:

You could easily use the CXFRS Component; if you need to do it using the HTTP Component for some reason you could easily use that as well:

<setHeader headerName="CamelHttpUri">
      <simple>http://localhost:8080/rest/api/2/project/${header.myKey}/components</simple>
</setHeader>
<inOut uri="http://doesnt.matter.we/override/it/anyways" />

当然,在到达路由的这一部分之前,您需要使用 myKey 标头来丰富您的消息.

And of course you will need to enrich your message with the myKey header before getting to this part of the route.

这篇关于如何通过 Apache Camel 调用 RESTful 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆