Using the Ws4J2ee tool
you need to have the following files
- webservice.xml file
- SEI(class file)
- Implementation bean(class file)
- ejb-jar.xml/web.xml file
- (optional wsdl file and jaxrpcmapping file/both or none)
Above files should be packaged in to a jar file as
follows
Use with JAR/(WAR/EAR not yet implemented) file
org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2EEwithoutWSDL jar-filec out-dir
(WAR/EAR file is not implemented)
for sample jar files build the ews and look in the target/generated/samples
If EJB based jar file should be like this
/-META-INF/webservice.xml
-META-INF/ejb-jar.xml
-SEI class
-service implementation bean class
-any other referance classes
If web based jar file should be like this
/-META-INF/webservice.xml
-META-INF/web.xml
-SEI class
-service implementation bean class
-any other referance classes
Use with Class files and DD are in directory hirachey
org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2EEwithoutWSDL arguments
args is String array s.t.
- first argument is webservice.xml file
- Other arguments are any option that can given to Java2WSDL
- the SEI and the service Implementation bean should be avalible on the class path
- the ws4j2ee will search for the web.xml or ejb-jar.xml
- same directory as the webservice.xml file
- file should be in the class path s.t META-INF/web.xml or META-INF/ejb-jar.xml
- if no file found at the #4 the ws4j2ee continue assuming the Impl bean and the DD is not avalible. This is additional to spec.
look at the org.apache.geronimo.ews.ws4j2ee.GenerateWithoutWSDLTest
Appendix
Service Endpoint Interface
The JAX-RPC specification requires that a JAX-RPC service endpoint interface must
follow the following rules:
- Service endpoint interface must extend java.rmi.Remote either directly or indirectly
- All methods in the interface must throw java.rmi.RemoteException. Methods may
throw service specific exceptions in addition to the RemoteException.
- Method parameters and return types must be the JAX-RPC supported Java types
(refer to the section 5.1, “JAX-RPC Supported Java Types”). At runtime, values of a
supported Java type must be serializable to and from the corresponding XML
representation.
- Holder classes may be used as method parameters. These Holder classes are either
generated or those packaged in the standard javax.xml.rpc.holders package.
- Service endpoint interface must not include constant (as public final static)
declarations. WSDL 1.1 specification does not define any standard representation for
constants in a wsdl:portType definition.
Service Implementation Bean
The Stateless Service Implementation Session Bean.
A Stateless Session Bean, as defined by the Enterprise JavaBeans specification,
can be used to implement a Web service to be deployed in the EJB container.
A Stateless Session Bean does not have to worry about multi-threaded access.
The EJB container is required to serialize request flow through any particular
instance of a Service Implementation Bean. The requirements for creating a Service
Implementation Bean as a Stateless Session EJB are repeated in part here.
- The Service Implementation Bean must have a default public constructor.
- The Service Implementation Bean may implement the Service Endpoint Interface,
but it is not required to do so. The bean must implement all the method
signatures of the SEI.
-
- The Service Implementation Bean methods are not required to throw
javax.rmi.RemoteException. The business methods of the bean must be public
and must not be final or static. It may implement other methods in addition
to those defined by the SEI.
- A Service Implementation Bean must be a stateless object.
A Service Implementation Bean must not save client specific state
across method calls either within the bean instance’s data members or
external to the instance.
- The class must be public, must not be final and must not be abstract.
- The class must not define the finalize() method.
- Currently, it must implement the ejbCreate() and ejbRemove() methods which
take no arguments. This is a requirement of the EJB container, but generally
can be stubbed out with an empty implementation.
- Currently, a Stateless Session Bean must implement the javax.ejb.SessionBean
interface either directly or indirectly. This interface allows the container to notify the Service Implementation Bean of impending changes in its state. The full requirements of this interface are defined in the Enterprise JavaBeans specification section 7.5.1.
- The Enterprise JavaBeans specification section 7.8.2 defines the allowed
container service access requirements.
Exposing an existing EJB
An existing Enterprise JavaBean may be used as a Service Implementation Bean if it meets the following requirements:
- The business methods of the EJB bean class that are exposed on the SEI must meet the Service
- Implementation Bean requirements defined in section 5.3.1.
- The SEI must meet the requirements described in the JAX-RPC specification for Service Endpoint Interfaces.
- The transaction attributes of the SEI methods must not include Mandatory.
- The developer must package the Web service as described in section 5.4 and must specify an ejb-link from the port in the Web services deployment descriptor to the existing EJB.
WebEndpoint Based Serivce Implementation Bean
The Service Implementation Bean must follow the Service Developer requirements outlined in the JAX-RPC specification and are listed below except as noted.
- ?The Service Implementation Bean must have a default public constructor.
- ?The Service Implementation Bean may implement the Service Endpoint Interface as defined by the JAX-RPC Servlet model. The bean must implement all the method signatures of the SEI. In addition, a Service Implementation Bean may be implemented that does not implement the SEI. This additional requirement provides the same SEI implementation flexibility as provided by EJB service endpoints. The business methods of the bean must be public and must not be static.
- If the Service Implementation Bean does not implement the SEI, the business methods must not be final. The Service Implementation Bean may implement other methods in addition to those defined by the SEI, but only the SEI methods are exposed to the client.
- ?A Service Implementation must be a stateless object. A Service Implementation Bean must not save client specific state across method calls either within the bean instance’s data members or external to the instance. A container may use any bean instance to service a request.
- ?The class must be public, must not be final and must not be abstract.
- ?The class must not define the finalize() method.