Skip to content
Advertisement

Vaadin with Apache CXF SOAP service

I am new to Vaadin, just generated the application in Vaadin web site and built it locally. Then I added Apache CXF SOAP service to it, but I am unable to use the Tomcat that Vaadin is using, but instead I load SOAP in Jetty using:

JavaScript

My Vaadin application is:

JavaScript

While this works, I would like to get rid of separate Jetty dependency and run the SOAP service in Vaadin Tomcat (localhost:8080). Should be simple but I can’t figure out how to do it. I think that it needs a separate servlet and route, but I don’t know how to add them. There is no web.xml in the Vaadin application, for example.

Advertisement

Answer

I am not familiar with Apache CXF, but based on CXF docs and the sample project I think I got it to work.

I downloaded a new Vaadin 14/Java 8 project from start.vaadin.com, and did the following:

  1. Added the dependency

    JavaScript
  2. Created a web service

    JavaScript
  3. Exposed it as a bean in my Application class

    JavaScript

That was it! At least I can now list the service definition at http://localhost:8080/services/Test?wsdl

The first documentation link lists some configurations you can do, for example to change the /services path. The example project shows how to configure Spring actuator metrics if that is something you need.

You might want to create a separate @Configuration-annotated class for all your service @Bean definitions.

If you don’t want to use the starter dependency, this Baeldung article looks promising.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement