-6

i am trying to route between two web services using camel-restlet.This is my pom.xml

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

can anybody help how to route between two web services only using camel-restlet and tomcat.This is my camel-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>
Akhil
  • 1
  • 1

1 Answers1

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();
    }
Prateek Mehta
  • 488
  • 1
  • 8
  • 15
  • hii prateek thanks for your reply ,i forgot to add a point in question that i am using camel restlet for routing in my application and also with XML DSL .I just edited the question please go through that and all your inputs are very helpful – Akhil Sep 16 '16 at 08:58