This is error what I received - java.lang.RuntimeException: Could not find conduit initiator for address: cxf:http://www.webservicex.net/stockquote.asmx and transport: http://schemas.xmlsoap.org/soap/http
I tried all possible solution which is available online but same response i receive each time.
Below is RouteBuilder Class
//@Component
public class CamelRouterImpl extends RouteBuilder {
ProducerTemplate template;
public CamelRouterImpl(ProducerTemplate template) {
// TODO Auto-generated constructor stub
this.template = template;
}
@
Override
public void configure() throws Exception {
// TODO Auto-generated method stub
System.out.println("---- RouteBuilder");
CxfComponent cxfComponent = new CxfComponent(getContext());
String url = "cxf:http://www.webservicex.net/stockquote.asmx";
CxfEndpoint serviceEndpoint = new CxfEndpoint(url, cxfComponent);
serviceEndpoint.setServiceFactory(ObjectFactory.class);
serviceEndpoint.setServiceClass(GetQuote.class);
GetQuote quote = new GetQuote();
quote.setSymbol("ibm");
Exchange exchange = template.send(serviceEndpoint, new Processor() {
@
Override
public void process(Exchange exchange) throws Exception {
// TODO Auto-generated method stub
exchange.getIn().setBody(quote);
}
});
org.apache.camel.Message out = exchange.getOut();
System.out.println(out.getBody());
}
}
Camel Context class
public class CamelContextImpl {
public void run() {
// TODO Auto-generated method stub
CamelContext context = new DefaultCamelContext();
try {
context.start();
ProducerTemplate template = context.createProducerTemplate(0);
template.start();
context.addRoutes(new CamelRouterImpl(template));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
//to stop consumer and route
//ConsumerTemplate.stop();
if (context != null) {
try {
context.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
Gradle build file
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE")
}
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'base'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.3.5.RELEASE'
compile group: 'org.apache.camel', name: 'camel-core', version: '2.17.0'
compile group: 'org.apache.camel', name: 'camel-cxf', version: '2.17.0'
compile group: 'axis', name: 'axis-wsdl4j', version: '1.5.1'
compile group: 'commons-lang', name: 'commons-lang', version: '2.3'
compile group: 'org.apache.cxf', name: 'cxf-rt-bindings-soap', version: '3.1.7'
compile group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: '3.1.7'
compile group: 'org.apache.cxf', name: 'cxf-rt-ws-policy', version: '3.1.7'
compile group: 'org.apache.cxf', name: 'cxf-rt-transports-http-jetty', version: '3.1.7'
compile group: 'org.apache.cxf', name: 'cxf-bundle', version: '3.0.0-milestone2'
}