2 Replies Latest reply on Jul 11, 2017 8:41 AM by Néstor Almeida

    EAP7 how to expose both JAX-RS and JAX-WS service with CXF

    Néstor Almeida Newbie

      Hi,

       

      I'm trying to expose a service using both restful and soap webservices apis (jax-rs and jax-ws). Currently I made it works using  only a few JAX-* annotations:

       

      @Path("/alertas")

      @WebService

      public class AlertasApi  {

      ...

         @GET   

          @Consumes({ "application/json", "application/xml" })

          @Produces({ "application/json", "application/xml" })

          @WebMethod

          public Alertas listarAlertas() {

      return alertasService.listarAlertas();

          };

      ...

       

      I can run both services without write any kind of configuration based schema (I only need a bunch of microservices and serve a maven site webpage for their documentation).

       

      I know that JBOSS EAP have a Apache CXF based API called JBOSSWS-CXF.

       

      My next steps are secure these services with authentication and authorization so I want to use CXF to have a single security context.

       

      I want to try to make it simply as possible, using annotations or api (method) based configuration but my major problem was that I can't use the JBOSSWS-CXF module.

       

      I specified the EAP server BOM in my Maven pom file:

       

      <dependency>

      <groupId>org.jboss.spec</groupId>

      <artifactId>jboss-javaee-7.0</artifactId>

      <version>${version.jboss.spec.javaee.7.0}</version>

      <type>pom</type>

      <scope>import</scope>

      </dependency>

       

      I can't see any reference to cxf or jbossws in my project imported libraries. Im getting crazy because I looked for any reference and I doesn't found anything.

       

      In resume:

      JBOSS EAP 7.0.0

      WAR deployment for REST and SOAP microservices

      Both uses the same java method and are configured by JAX annotations

      Using Maven for project dependencies

      I want to secure the services so I want to use a API that implements security on both (rest and soap) exposed services

      I want to make it as simply as possible

       

      Wich is is best approach to make it work? CXF? In this case, how can I use native JBOSS CXF (JBOSSWS-CXF) in my Maven project.

       

      Thanks you in advance.