camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "magic.coder" <nilotpal.bar...@gmail.com>
Subject problem with camel-http routing with spring dsl
Date Wed, 11 Jul 2012 10:01:16 GMT
Hi I am trying to call a webservice using camel-http component.

When I write my routing logic using java-dsl, it just works fine and I can
retrieve the soap response in String format as out message body. However,
when I do the same using spring-dsl I get the following error.

*WARN  DirectProducer - No consumers available on endpoint:
Endpoint[direct://MyProducerUri] to process: Exchange[Message:
<soapenv:Envelope ....> .... </soapenv:Envelope>]*

and I get the response as null.

Following is my code and camel-route.xml.

*ApplicationContext applicationContext = new
ClassPathXmlApplicationContext("META-INF/spring/camel-route.xml");
CamelContext context = new SpringCamelContext(applicationContext);

try {
context.start();
String soapMessage = "<soapenv:Envelope ....>.....</soapenv:Envelope>"; //
Truncating the actual soap request xml content here with .... .
Exchange exchange = new DefaultExchange(context);
ProducerTemplate template = exchange.getContext().createProducerTemplate();
exchange.getIn().setBody(soapMessage);
exchange.setPattern(ExchangePattern.InOut);
exchange.getIn().setHeader("SOAPAction", "");
exchange = template.send("direct:MyProducerUri", exchange);
String output = exchange.getOut().getBody(String.class);
System.out.println(output);
} finally {
context.stop();
}*

camel-route.xml

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:camel="http://camel.apache.org/schema/spring"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://camel.apache.org/schema/spring 
         http://camel.apache.org/schema/spring/camel-spring.xsd">         
	
         <camelContext xmlns="http://camel.apache.org/schema/spring">
		<route>
			<from uri="direct:MyProducerUri"/>
			<to
uri="http://localhost:8080/camel-example-cxf-tomcat/webservices/incident"/>
		</route>
	</camelContext>
</beans>

Routing logic in java dsl-->

context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
   
from("direct:MyProducerUri").to("http://localhost:8080/camel-example-cxf-tomcat/webservices/incident");
}
});

I have deployed the webservice in my local machine tomcat.
Please help me with this. I am sure this is some configuration issue.

--
View this message in context: http://camel.465427.n5.nabble.com/problem-with-camel-http-routing-with-spring-dsl-tp5715852.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message