I have a EJB project (to run In Websphere), which is also a WebService client. Previously, we created the client classes manually, using the wsimport command. Now we want to automate the process using the JAX-WS Maven Plugin, goal jaxws:wsimport .
The generation is almost perfect except for a fact: the webservice classes (with the annotation @WebService
) should have also the @Stateless
annotation. Without this, Eclipse complains that @WebService annotation in EJB modules can be only used on stateless session beans. Actually, the prior versions of these classes (presumably created using manually wsimport), had the @Stateless annotation.
I suppose that it should have some configuration telling to wsimport
to generate the classes as Stateless. However, I did not find it neither in wsimport documentation nor in the Maven Plugin one.
Below I show my POM configuration:
<properties>
<wsdl.dirs>${basedir}/src/main/resources/META-INF</wsdl.dirs>
<wsdl.package.basic>com.porto.sinistro.orcamentomultiempresa</wsdl.package.basic>
</properties>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<!--
Other executions, using other WSDL files.
-->
<execution>
<id>wsdl-cartaAutorizacao-exec</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<packageName>${wsdl.package.basic}.upload.cartaAutorizacao.client</packageName>
<wsdlFiles>
<wsdlFile>${wsdl.dirs}/CartaAutorizacaoWSService.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>META-INF/CartaAutorizacaoWSService.wsdl</wsdlLocation>
</configuration>
</execution>
</executions>
<configuration>
<bindingDirectory>${basedir}/src/main/java</bindingDirectory>
<sourceDestDir>${basedir}/src/main/java</sourceDestDir>
<verbose>true</verbose>
<target>2.0</target>
<xnocompile>true</xnocompile>
</configuration>
</plugin>
</plugins>
For the WSDL mentioned above, the Webservice class has this form:
@WebService(name = "CartaAutorizacaoWS", targetNamespace = "http://client.ws.soma.upload.sinistro.porto.com/cartaautorizacao")
// Where is the @Stateless?
public interface CartaAutorizacaoWS {
// ...
}
Which configuration should I do to generate @Stateless
WebServices?
Thanks,
Rafael Afonso