This rule detects the presence of JAX-RPC web services based on the
following criteria:
- The presence of the file, web-services.xml
- The presence of the file, weblogic-webservices.xml,
and the file, webservices.xml, in the same folder
Manual solution
To generate JAX-RPC web services based on WebLogic J2EE web service deployment descriptors, you must manually create an Ant script using specific
IBM® Ant tasks. The script should be added to the root folder of the project if an IBM Ant-generated file does not already exist. These tasks will
handle the generation of the JAX-RPC web services from the deployment descriptors.
Rule properties
You must provide the correct values for the rule properties to ensure accurate results during analysis. These properties should be reviewed and
configured appropriately based on your application’s context. The properties for this rule are:
- Generated Ant script name
:
Specifies the name of the new Ant script generated. The script
name must be a valid file name. The value must not include any forward or backward slashes. The script will be in the root folder of the project.
Default value: build-ibm-ws.xml
- Generation folder name :
Specifies the name of the folder in which generation artifacts will reside.
The value must not include any forward or backward slashes. The generation
folder will be in root folder of the project.
Default value: ibm-ws-gen
Ant class path
The ant class path is calculated from the Eclipse project.
It is important to verify that all the elements that are required for
compilation are on the Eclipse class path.
JAX-RPC services that are defined in the web-services.xml file
Based on the information and type of services defined in the
web-services.xml, an Ant script,
and possibly additional Java code that represents the web service endpoint interface
is generated to reproduce the JAX-RPC service.
- Supported components
Only Stateless Session enterprise beans (<stateless-ejb>) and Java(R) (<java-class>) components
can be recognized and converted.
- Stateless EJB components:
The Enterprise JavaBeans(TM) (EJB) JAR file, as defined in the path attribute of the
<ejb-link> element, must exist in the project. The automated fix will
scans the EJB JAR file and generates a new Service Endpoint Interface
(SEI) class based on the EJB remote class.
SEI interfaces differ from EJB remote interfaces in
that the class must extend
java.rmi.Remote
,
and each method must throw the exception,
java.rmi.RemoteException
.
The automated fix will use Java reflection on the EJB
remote interface to generate the new SEI .
Therefore, ensure that your Eclipse project classpath includes
all the necessary classes, JAR files, and directories required
to successfully load the EJB remote class.
The SEI must be generated in the folder, sei, inside
the generation folder, as provided by the user in the rule
properties. The SEI package matches the EJB remote interface
package and the SEI name will be the same as the EJB remote interface
with the word SEI appended to it. In addition, the new SEI folder
is added to the project class path.
- Java class components:
Similar to the EJB components, the automated fix will generate a Service Endpoint Interface
from the Java class that is defined in the attribute <class-name>.
- Generated Ant targets:
The generated Ant script contains targets to
generate the WSDL file and the JAX-RPC service based on the new SEI that
will be created.
The WSDL generation target will have the name,
genWSDL_ssss, where ssss is the name of the JAX-RPC service that was
provided in the name attribute field of the <web-service>
element.
The service generation targets have the name,
genService_pppp, where pppp is the name of the component from the name
attribute of the element <stateless-ejb> or
<java-class>.
The automated fix will not use the information provided
in other elements, such as <handlers-chain>, <types>,
<operations>, <security> and so on.
JAXRPC services defined in the webservices.xml file
Based on the information and type of services defined in the
webservices.xml file, an Ant script is generated to reproduce the JAX-RPC
service.
- Generated Ant targets:
The generated Ant script contains targets to
generate the WSDL file and the JAX-RPC service.
The WSDL generation target is only generated if
you cannot locate the WSDL file as defined in the element,
<wsdl-file>.
If it is created, the WSDL generation target has
the name, genWSDL_ssss, where ssss is the name of the service as defined
in the element, <webservice-description-name>.
The service generation targets will have the name,
genService_pppp, where pppp is the name of port as defined by the
element <port-component-name>.
IBM WebSphere Application Server Ant Tasks
WebSphere(R) Application Server includes Ant tasks such as java2wsdl
and wsdl2java to generate the necessary artifacts for JAX-RPC
services. The generated Ant script uses these tasks to build the
service.
Additional information on these tasks can be obtained from the
WebSphere Application Server documentation.
Running the Ant script
Once you have produced the Ant script, view the script, and add additional customizations if necessary.
Consult the Application Server documentation about additional customizations for the IBM Ant tasks.
You must run the script using the Ant tools that
are included with WebSphere Application Server. The IBM Ant script
can be run from:
- WAS_HOME\bin\ws_ant.bat on Windows(R) operating systems
- WAS_HOME\bin\ws_ant.sh on UNIX(R) operating systems
Example: c:\IBM\AppServer\bin\ws_ant.bat -f
c:\eclipse\MyProject\ibm-ws-gen.xml genService_TestService
Once the Ant targets are run, the produced artifacts reside
in the generation folder. The user can then inspect the generated
code and deployment descriptors, and then add these artifacts to their
modules.