2016-09-16 99 views
-5

我使用駱駝restlet.This是我的pom.xml如何路由使用Apache駱駝的Restlet

<repositories> 
    <repository> 
     <id>maven-restlet</id> 
     <name>Public online Restlet repository</name> 
     <url>http://maven.restlet.org</url> 
    </repository> 
</repositories> 
<dependencies> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-core</artifactId> 
     <version>2.17.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.restlet.jee</groupId> 
     <artifactId>org.restlet</artifactId> 
     <version>2.3.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.restlet.jee</groupId> 
     <artifactId>org.restlet.ext.httpclient</artifactId> 
     <version>2.3.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.restlet.jee</groupId> 
     <artifactId>org.restlet.ext.spring</artifactId> 
     <version>2.3.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-http</artifactId> 
     <version>2.17.1</version> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

任何人可以幫助如何設法兩個Web服務之間路由一個休息服務的響應到另一個REST服務兩個Web服務之間的航線只能用駱駝的Restlet和tomcat.This是我的駱駝的context.xml

<beans> 
<camelContext> 
    <route> 
    <from uri="restlet:/bid/req?restletMethods=GET"/> 
    <to uri="cxfrs:http://localhost:8080/xxxxxxxxxx"/> 
    </route> 
</camelContext> 
<bean id="RestletComponent" class="org.restlet.Component" /> 
<bean id="RestletComponentService" class="org.apache.camel.component.restlet.RestletComponent"> 
    <constructor-arg index="0"> 
    <ref bean="RestletComponent"/> 
    </constructor-arg> 
</bean> 
</beans> 
+0

你提的問題是非常廣泛的。除非你使它更具體,並且重點和顯示你的代碼和錯誤,否則它將很難提供幫助。 –

+0

Hai Souciance感謝您的建議,我編輯了我的問題,請檢查一次。 – Akhil

回答

0
The response returned from 1st service is set in exchange body. Retrieve body at the 2nd service endpoint to get response. 



    .to("bean:beanName?method=testMethod"); 
    .to("bean:beanName2?method=testMethod2"); 

     public Response testMethod() { // This line will return testMethod respose in exchange body 
     return response; 
     } 
     public void testMethod2() { 
     Response response = exchange.getIn().getBody(); 
    } 
+0

hii prateek感謝您的回覆,我忘了添加一個問題,我使用駱駝restlet在我的應用程序和XML DSL的路由。我剛剛編輯的問題,請通過這一點,所有的輸入是非常有用的 – Akhil