Hi all, first time poster here and a first time user of Camel 

I have a working Spring Boot service developed using the example provided
here https://spring.io/guides/gs/producing-web-service/ 

I built a web service from a provided WSDL file. The service needed to
support SOAP12 as shown in the code, this is done. All is working. This can
be started as a service and will work as expected.

With the service working, the jar is provided as a dependent jar to another
application. This application is an akka scala application. The idea is to
use Camel to consume the endpoints of the Spring Boot jar

        @EnableWs
        @Configuration
        public class WebServiceConfig extends WsConfigurerAdapter {
                @Bean
    public ServletRegistrationBean
messageDispatcherServlet(ApplicationContext applicationContext) {
        MessageDispatcherServlet servlet = new MessageDispatcherServlet();
        servlet.setApplicationContext(applicationContext);
        servlet.setTransformWsdlLocations(true);

        servlet.setMessageFactoryBeanName("soap12");

        return new ServletRegistrationBean(servlet, "/myEvents/*");
    }

    @Bean 
    public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema
mySchema) {
        DefaultWsdl11Definition wsdl11Definition = new
DefaultWsdl11Definition();
        wsdl11Definition.setPortTypeName("EventService");
        wsdl11Definition.setLocationUri("/myEvents");
        wsdl11Definition.setTargetNamespace("http://event";);
        wsdl11Definition.setSchema(mySchema);

        return wsdl11Definition;
    }
    @Bean
    public XsdSchema mySchema() {
        return new SimpleXsdSchema(new ClassPathResource("mySchema.xsd"));
    }

    @Bean(name = "soap12")
    public SaajSoapMessageFactory soap12MessageFactory() throws
SOAPException {
        SaajSoapMessageFactory factory = new
SaajSoapMessageFactory(MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL));
        return factory;
    }  

    // Added to suppport Camel. 
    @Autowired
    CamelContext camelContext;

    @Bean  public CamelEndpointMapping  endpointMapping() { 
        return new CamelEndpointMapping();
    }

    @Bean
    public EndpointAdapter messageEndpointAdapter() {
        return new MessageEndpointAdapter();
    }

}
The following dependencies were added to the maven pom file. 

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>2.16.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-boot</artifactId>
        <version>2.16.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-ws</artifactId>
        <version>2.16.2</version>
    </dependency>
        
My endpoint remains as it was working (although I never expect this to get
called if the camel route is setup - is that a correct assumption?) 

        @Endpoint 
        public class HeartbeatEndpoint {
                private static final String NAMESPACE_URI = "http://myevent";;

                @Action("http://myevent/Heartbeat";) 
                @ResponsePayload
                public HeartbeatResponse Heartbeat(@RequestPayload Heartbeat 
arg) {
                        HeartbeatResponse response = new HeartbeatResponse();
                        response.setHeartbeatResult(5);
                        System.out.println("HEART BEAT");
                        return response;
                }
        }

The Scala Camel consumer.

        val camel = CamelExtension(actorSystem).context
        SpringApplication.run(classOf[Application])     // Call the Java Spring
Boot dependent jar file to host the endpoints. 
        actorSystem.actorOf(Props(classOf[CamelService])


          //// I know that I now have 2 CamelContext's created; one in the
actor system and one in the spring boot application.. How is this to be
shared ?????? 

        class CamelService extends Consumer {
          def endpointUri = "spring-ws:http://localhost:8080/http://event";

          def receive: Receive = {
                case s @ _ => println("Received " + s)
          }
         }
         
Note: on startup the following is printed

        2016-01-29 10:21:24.728  INFO 15652 --- [           main]
ationConfigEmbeddedWebApplicationContext : Refreshing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@70beb599:
startup date [Fri Jan 29 10:21:24 GMT 2016]; root of context hierarchy
        2016-01-29 10:21:26.821  INFO 15652 --- [           main]
o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for
bean 'beanNameViewResolver' with a different definition: replacing [Root
bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3;
dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration;
factoryMethodName=beanNameViewResolver; initMethodName=null;
destroyMethodName=(inferred); defined in class path resource
[org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]]
with [Root bean: class [null]; scope=; abstract=false; lazyInit=false;
autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter;
factoryMethodName=beanNameViewResolver; initMethodName=null;
destroyMethodName=(inferred); defined in class path resource
[org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
        2016-01-29 10:21:27.251  INFO 15652 --- [           main]
trationDelegate$BeanPostProcessorChecker : Bean
'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [class
org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$67832a83]
is not eligible for getting processed by all BeanPostProcessors (for
example: not eligible for auto-proxying)
        2016-01-29 10:21:27.445  INFO 15652 --- [           main]
trationDelegate$BeanPostProcessorChecker : Bean
'camel.springboot.CONFIGURATION_PROPERTIES' of type [class
org.apache.camel.spring.boot.CamelConfigurationProperties] is not eligible
for getting processed by all BeanPostProcessors (for example: not eligible
for auto-proxying)
        2016-01-29 10:21:27.670  INFO 15652 --- [           main]
trationDelegate$BeanPostProcessorChecker : Bean 'camelContext' of type
[class org.apache.camel.spring.SpringCamelContext] is not eligible for
getting processed by all BeanPostProcessors (for example: not eligible for
auto-proxying)
        2016-01-29 10:21:27.671  INFO 15652 --- [           main]
trationDelegate$BeanPostProcessorChecker : Bean 'webServiceConfig' of type
[class
com.aspect.manhattan.hubchannel.ctips.ws.producer.config.WebServiceConfig$$EnhancerBySpringCGLIB$$201e0532]
is not eligible for getting processed by all BeanPostProcessors (for
example: not eligible for auto-proxying)
        2016-01-29 10:21:27.677  INFO 15652 --- [           main]
trationDelegate$BeanPostProcessorChecker : Bean
'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type
[class
org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$bd9acd63]
is not eligible for getting processed by all BeanPostProcessors (for
example: not eligible for auto-proxying)
        2016-01-29 10:21:27.712  INFO 15652 --- [           main]
.w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August
2004, WS-Addressing 1.0]

Starting the scala application will host the web service and the service is
called as normal. I was expecting that the messageDispatcher would route the
calls to the Camel Endpoint ie: that HeartbeatEndpoint method Heartbeat
would never get called. This is not what is happening.

        2016-01-29 10:02:47.723  INFO 14988 --- [nio-8080-exec-1]
o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring
FrameworkServlet 'messageDispatcherServlet'
        2016-01-29 10:02:47.723  INFO 14988 --- [nio-8080-exec-1]
o.s.w.t.http.MessageDispatcherServlet    : FrameworkServlet
'messageDispatcherServlet': initialization started
        2016-01-29 10:02:47.730  INFO 14988 --- [nio-8080-exec-1]
o.s.w.t.http.MessageDispatcherServlet    : FrameworkServlet
'messageDispatcherServlet': initialization completed in 7 ms
        HEART BEAT  
        
        
Any help or guidance appreciated.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Akka-Camel-and-Spring-Boot-tp5777000.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to