Generate stubs for EJB3.1 bean exposed as webservice
Simon Joseph Aquilina
posted 4 years ago
Hello, I am trying to use Maven to generate stubs for an EJB3.1 bean exposed as a Webservice. My example is as follows; I have an EAR with a JAR containing my EJB3.1 bean and a WAR which contains a Servlet that access this bean as a webservice. The bean code is as follows:
From the Servlet I call the webservice as follows:
This works fine. However on some books and the Internet I also found examples using @WebReference to inject an instance in an object of type HelloService as follows.
However I cannot understand how to generate HelloService from HelloBean. From the Internet I found out that JBossWS - JAX-WS Tools wsconsume will generate HelloService.java when given a WSDL file. However I can't seem to make it work when giving it a bean. From my maven project I tried adding the following plugin definition (glassfish project):
However this only generate classes to represent all methods in HelloBean and their return values. In short I still did not manage to generate HelloService from HelloBean so that from my Servlet I can avoid boilerplate code.
Does anyone know how I can generate stubs for an EJB3.1 bean most importantly the xxxService class? Or at least correct me if my reasoning regarding this class is wrong.