I just need to call a soap url using a rest service, it is quite urgent but no success even after some reading and searching on web.
The rest service is just for calling soap service with getHelloWorldAsString method. I have followed many thread but no success, my soap service is running file and I can access it directly. I am using spring with Jboss eap, here is my camel context file: ------------------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd "> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <bean class="com.aexp.loyalty.web.controller.ConsumerController" id="consumerController" /> <bean class="com.aexp.loyalty.dao.impl.ConsumerDAOImpl" id="DaoImpl" /> <bean class="com.aexp.loyalty.services.impl.ConsumerServiceImpl" id="ServiceImpl" /> <bean id="myProcessor" class="com.apex.loyalty.processor.MyProcessor" /> <cxf:rsServer id="restcxfService" address="/"> <cxf:serviceBeans> <ref bean="consumerController" /> </cxf:serviceBeans> <cxf:providers> <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> </cxf:providers> </cxf:rsServer> <cxf:cxfEndpoint id="customerSoapServiceEndpoint" address="http://localhost:9090/ws/hello" wsdlURL="http://localhost:9090/ws/hello?wsdl" serviceClass="com.aexp.loyalty.mock.soap.ws.HelloWorldImplService" endpointName="s:HelloWorldImplPort" serviceName="s:HelloWorldImplService" xmlns:s="http://ws.soap.mock.loyalty.aexp.com/" /> <camelContext xmlns="http://camel.apache.org/schema/spring"> <route id="rsRoute"> <from uri="cxfrs:bean:restcxfService" /> <to uri="log:input" /> <process ref="myProcessor" /> <removeHeaders pattern="CamelHttp*" /> <to uri="direct:callingSoapDirect" /> </route> <route id="callingSoapDirect"> <from uri="direct:callingSoapDirect" /> <to uri="direct:invokePartnerEnrollmentSOAP" /> </route> <route id="invokePartnerEnrollmentSOAP"> <from uri="direct:invokePartnerEnrollmentSOAP" /> <removeHeaders pattern="CamelHttp*" /> <to uri="http://localhost:9090/ws/hello/getHelloWorldAsString?bridgeEndpoint=true" /> </route> </camelContext> </beans> ---------------------------------------------------------------------------------------- public class MyProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { System.err.println(" I am processing the rest request"); // exchange.getIn().setHeader("operationName", "getHelloWorldAsString"); exchange.getIn().setBody(""); // exchange.getIn().setBody(new InputStream() { // // @Override // public int read() throws IOException { // // TODO Auto-generated method stub // return 0; // } // }); } } -------------------------------------------------------------------- Controller for rest, I am just getHelloWorldAsString method rest is useless: @Component @Path("/v1") public class ConsumerController { ConsumerService consumerService; Logger log = Logger.getLogger(ConsumerController.class); @GET @Path("getHelloWorldAsString") @Produces("application/json") public Response getHelloWorldAsString() { return Response.ok().build(); } @GET @Path("consumers/{consumerId}") @Produces("application/json") public Response getConsumerId(@PathParam("consumerId")Integer consumerId) { return null; /*log.info("Inside getConsumerId :: consumerId :: "+consumerId); if(consumerId <= 0){ return Response .status(Response.Status.BAD_REQUEST) .entity("{\"error\":\"Invalid consumer id \"}").type("application/json") .build(); } try{ consumerService = (ConsumerService) ApplicationContextProvider.getBean("consumerService"); Consumer consumer = consumerService.fetchConsumerByIdService(consumerId); log.info("fetched consumer :: "+consumer); if(consumer != null && consumer.getConsumerId() != null) return Response.ok().entity(consumer).build(); } catch(Exception exception){ log.error(exception.getMessage()); } return Response .status(Response.Status.NOT_FOUND) .entity("{\"error\":\"Consumer information not found\"}").type("application/json") .build(); */ } @POST @Path("consumer") @Produces("application/json") public Response saveConsumer(Consumer consumer){ return null; /*log.info("inside saveConsumer:: consumer::"+consumer); if(consumer != null && consumer.getName() != null){ try{ consumerService = (ConsumerService) ApplicationContextProvider.getBean("consumerService"); Consumer createdConsumer = consumerService.saveConsumer(consumer); if(createdConsumer != null){ return Response .status(Response.Status.CREATED) .entity(createdConsumer).type("application/json") .build(); } }catch(Exception exception){ log.error(exception.getMessage()); } } return Response .status(Response.Status.BAD_REQUEST) .entity("{\"error\":\"Unfortunately, the application cannot process your request at this time \"}").type("application/json") .build();*/ } /* @PUT @Path("put/consumer") @Produces("application/json") public Response updateConsumer(Consumer consumer){ log.info("inside UPDATEConsumer:: consumer::"+consumer); if(consumer != null && consumer.getConsumerId() != null && consumer.getName() != null){ try{ consumerService = (ConsumerService) ApplicationContextProvider.getBean("consumerService"); Consumer updatedConsumer = consumerService.updateConsumer(consumer); if(updatedConsumer != null){ return Response .status(Response.Status.OK) .entity(updatedConsumer).type("application/json") .build(); } }catch(Exception exception){ log.error(exception.getMessage()); } } return Response .status(Response.Status.NOT_FOUND) .entity("{\"error\":\"Consumer information not found\"}").type("application/json") .build(); } @DELETE @Path("delete/consumers/{consumerId}") @Produces("application/json") public Response deleteConsumerId(@PathParam("consumerId")Integer consumerId) { log.info("Inside deleteConsumerId :: consumerId :: "+consumerId); if(consumerId <= 0){ return Response .status(Response.Status.BAD_REQUEST) .entity("{\"error\":\"Invalid consumer id \"}").type("application/json") .build(); } try{ consumerService = (ConsumerService) ApplicationContextProvider.getBean("consumerService"); Consumer consumer = consumerService.deleteConsumerByIdService(consumerId); log.info("deleted consumer :: "+consumer); if(consumer != null && consumer.getConsumerId() != null) return Response.ok().entity(consumer).build(); } catch(Exception exception){ log.error(exception.getMessage()); } return Response .status(Response.Status.NOT_FOUND) .entity("{\"error\":\"Consumer information not found\"}").type("application/json") .build(); }*/ } -- View this message in context: http://camel.465427.n5.nabble.com/Not-able-to-call-a-direct-http-soap-service-using-rest-service-different-exceptions-are-coming-tp5775642.html Sent from the Camel - Users mailing list archive at Nabble.com.