1

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'    

}

Ralf
  • 363
  • 3
  • 9
  • Do you have all the necessary jars in your classpath? See http://stackoverflow.com/questions/7611803/cxf-2-4-2-no-conduit-initiator-was-found-for-the-namespace-http-schemas-xmlso for more information. Maybe the transport https jar is missing – soilworker Aug 10 '16 at 14:51
  • thanks for the reply but I am using all required jars and this one too- cxf-rt-transports-http-jetty. Below jars I have used in my sample project -spring-boot-starter-web,camel-core,camel-cxf,axis-wsdl4j,commons-lang,cxf-rt-bindings-soap,cxf-rt-frontend-jaxws,cxf-rt-ws-policy,cxf-rt-transports-http-jetty,cxf-bundle. – Kuldeep Singh Aug 11 '16 at 07:31

1 Answers1

0

Try removing cxf:// or cxf: from the beginning for the URL. You don't need to specify the camel component since you are using CxfEndpoint to construct the call.

Ralf
  • 363
  • 3
  • 9