Reputation: 406
I am working on spring rest app with camel routes. I need to create route for each rest calls and transfer data to another soap server.Here is my code snippet.
public class CreateEmployeeController{
@Autowired
ProducerTemplate producerTemplate;
@RequestMapping (value = "/api/createEmployee",method = RequestMethod.POST)
public void createEmployee(@RequestBody Object employee) {
producerTemplate.sendBody("direct:createEmployee",employee);
}
@Configuration
@ComponentScan ("com.employee.restService")
public class RouteConfig extends CamelConfiguration {
}
@Configuration
@Component
public class CreateEmployeeRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:createEmployee")
.to("spring-ws:CreateEmployeeEndpointService");
}
}
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.19.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-cxf -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.19.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-spring-javaconfig -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-javaconfig</artifactId>
<version>2.19.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-spring-ws -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-ws</artifactId>
<version>2.19.2</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot</artifactId>
<version>2.19.2</version>
</dependency>
org.apache.camel.spring.boot.CamelSpringBootInitializationException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
route1 at: >>> To[spring-ws:CreateEmployeeEndpointService] <<< in route:
Route(route1)[[From[direct:createEmployee]] -> [To[spring-ws... because of Failed to resolve endpoint: spring-ws://CreateEmployeeEndpointService due to: No component found with scheme: spring-ws
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:225) ~[camel-spring-boot-2.19.2.jar:2.19.2]
Please help me if I am wrong. Thanks in advance.
Upvotes: 0
Views: 3679