1 Reply Latest reply on Oct 22, 2016 1:54 PM by Frank Langelage

    EJB injection not working in REST-WS but working in SOAP-WS

    Frank Langelage Master

      I created my first simple REST-WebService, until now we were only using SOAP based WebServices. Both are in the same package and end up in the same deployment unit.

      In the SOAP-WebServices the injection of EJBs works, in the REST-WebService they are not injected ending up in Nullpointer-Exceptions.

      Is this expected? What do I have to change to make EJB injection working also for the REST-Webservice?

       

      @Path("/salesOrder")
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      public class SalesOrderRestService
      {
          private static final Logger LOGGER = Logger.getLogger( SalesOrderRestService.class );
      
          @EJB
          private SalesOrder sol;
      ...
      }
      
      

       

      @WebService
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public interface SalesOrderWSI
      {
      
      }
      
      

       

      @WebService(endpointInterface = "biz.mbisoftware.fn.ws.sales.SalesOrderWSI", serviceName = "SalesOrderWS")
      public class SalesOrderWS implements SalesOrderWSI
      {
          private static final Logger LOGGER = Logger.getLogger( SalesOrderWS.class );
      
          @EJB
          private SalesOrder sol;
      
      ...
      }