2017-08-29 10 views
0

私はSpring MVCに取り組んでおり、Apache camelを使用して外部サービスを統合しています。 Webサービス呼び出しを行うためにApache Camelルートを使いたかったのです。Camelによる外部REST Webサービスのルーティング

私のローカルRESTサービス(http://localhostsmiliex.xx:8080/users)が外部RESTサービス(http://xxx:000/users)からデータを取得し、外部データを取得するようにしたいのですが。

JettyやプロデューサテンプレートなどのWebサービスルートに適したApacheコンポーネントはどれですか?

答えて

0

HTTP4またはHTTPを試しましたか? http://camel.apache.org/http4.html

+0

をautowireするか、ありがとうございますあなたは雄弁です。この方法で..私のアプリケーションルータの( "direct:start").to( "http://services.groupkt.com/country/get/all")から、トリガの春のMVCアプリケーションが得られません。 – DevD

0

使用ProducerTemplate、それは外部のエンドポイントのRESTを呼び出すための魔法のように動作し、DB、SOAPなど。

あなたはそれを

@Autowired 
ProducerTempalete prodcuerTemplate 
prodcuerTemplate.sendBody("http://xyz...", "<hello>world!</hello>"); 

または

ProducerTemplate template = exchange.getContext().createProducerTemplate(); 

// send to default endpoint 
template.sendBody("<hello>world!</hello>"); 

// send to a specific queue 
template.sendBody("http://xyz...", "<hello>world!</hello>"); 
関連する問題