to 1st:
you can create a processor to handle data from your webservice. your processor can be wired to your route builder. your routebuilder could look like the follwoing:
public class MyRouteBuilder extends SpringRouteBuilder {
@Autowired
private MyProcessor myProcessor;
@Override
public void configure() throws Exception {
from("xy")
.process(myProcessor);
}
}
your processor:
public class MyProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
Message msg = exchange.getIn();
//do something with your message
}
}
of course you have to create a bean of your processor. you could do it with annotating it and enable the spring component scan or define it in your spring-context.xml:
<bean class="com.package.of.your.processor.MyProcessor" />
to 2nd:
it is like @Sergey said. you can instanciate your context in your spring config.
with my example your springconfig would look like:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean class="com.package.of.your.processor.MyProcessor" />
<bean id="myRouteBuilder" class="com.package.of.your.routbuilder.MyRouteBuilder" />
<camel:camelContext id="camelContext">
<camel:routeBuilder ref="myRouteBuilder" />
</camel:camelContext>
</beans>