![[21.0.0.11 and later]](../ng_v210011plus.gif)
Migrating JAX-RPC applications to Liberty by using Gradle
You can use the Liberty JAX-RPC conversion tool for Gradle to convert JAX-RPC applications to use JAX-WS technology so that they can run on Liberty. This tool is a Gradle plug-in that supports the conversion of JAX-RPC client and service applications.
Before you begin
- Gradle 7.x
- Java SE
- Versions 1.0 and 1.1 of the conversion tool support Java SE 8.
- Versions 1.2 and later of the conversion tool support Java SE 8 and Java SE 11.
Although the tool itself does not require any specific Liberty version, the converted applications that it creates can run only on version 21.0.0.11 or later.
About this task
The Liberty JAX-RPC conversion tool for
Gradle can validate whether a traditional WebSphere application that uses JAX-RPC technology can be
converted into an application that uses JAX-WS technology. If the application passes validation, the
tool can convert the application binary to JAX-WS so that it can run on Liberty. However, the dynamic invocation
interface (DII), which uses the javax.xml.rpc.Call
interface, is not supported.
Also, to convert JAX-RPC service applications, the wsdl
files must either be
located within the service application or be referenced by a URL in the deployment descriptor file
for the conversion to succeed. This tool is available only to licensed WebSphere® Application Server Liberty users.
Procedure
Results
- The
validateWSDL
task produces console output that specifies whether the application passed validation. A WSDL file that is not valid for conversion produces output with details on the issues that were found. - After you successfully run the
replaceJAXRPC
task, the original application is located in the build/jax-rpc-tools-apps/originalApplications directory and the converted application is located in the build/jax-rpc-tools-apps/convertedApplications directory. A change log that is named <original_archive_name>.change.log is generated in the build directory for each converted application. - You can also convert a JAX-RPC application by using a multi-module Gradle project.
Configuration parameters
Parameter | Description |
---|---|
applications |
Multiple application blocks can be added to the applications configuration. This parameter is required if no project application or dependencies are specified. |
eeLevel |
An optional string that specifies which level of Java EE is used when deployment descriptors
are converted. The valid values are 7 or 8 . The default value is
7 . |
interopRequired |
An optional Boolean value that indicates whether the WSDL files are checked for conditions
that might make the application not interoperate with a JAX-RPC client or service after conversion.
If interoperability is not required, set this parameter to false . The default value
is true . |
applications
parameter, it must contain at least one
application
subparameter. This subparameter specifies the application to process
and must contain either a appLocation
or wsdlLocation
parameter.
The following table lists the parameters are available for the application
subparameter.
Parameter | Description |
---|---|
appLocation |
The location of the application WAR or EAR file to process. This parameter is required for
the replaceJAXRPC task, or if no project application is specified and the
wsdlLocation parameter is not set. |
eeLevel |
An optional string value that specifies which level of Java EE is used when deployment
descriptor files are converted. Valid values are 7 and 8. If this parameter is not specified, the
eeLevel value from the common configuration is used. |
interopRequired |
An optional Boolean value that indicates whether the WSDL files are checked for conditions
that might make the application not interoperate with a JAX-RPC client or service after conversion.
If this parameter is not specified, the interopRequired value from the common
configuration is used. |
wsdlLocation |
Location of the WSDL file or WSDL URL. This parameter is valid only for the
validateWSDL task and is required when the appLocation parameter
is not set and no project application is specified. |
Configuration examples
libertyJAXRPC
extension in your build.gradle
file.- Convert an application from JAX-RPC technology to JAX-WS technology with the
replaceJAXRPC
task by using the appLocation parameter.libertyJAXRPC { applications { testApp { appLocation = file(`src/test/resources/TestApp.war`) } } }
- Convert an application from JAX-RPC technology to JAX-WS technology with the
replaceJAXRPC
task by using the configuration from thelibertyJAXRPC
section.libertyJAXRPC { applications { testApp { appLocation = file(`src/test/resources/TestApp.war`) } } }
- Validate a WSDL file with the
validateWSDL
task by using a URL in the wsdlLocation parameter.libertyJAXRPC { applications { testApp { wsdlLocation = `http://localhost:9080/TestApp/services/TestAppIF?wsdl` } } }
- Validate the WSDL files within the specified application with the
validateWSDL
task by using the appLocation parameter.libertyJAXRPC { applications { testApp { appLocation = file(`src/test/resources/TestApp.war`) } } }
Converting a JAX-RPC application by using a multi-module Gradle project
You can use a multi-module Gradle project to convert an existing JAX-RPC application to JAX-WS
and deploy it to Liberty. In this
configuration, a top-level settings.gradle
file specifies two submodules: one to
convert and repackage the application and another to install and run it on an instance of Liberty
This example uses version 1.0 of the JAX-RPC conversion tool. Replace the version number in your configuration to reflect the version of the tool that you downloaded from IBM Fix Central.
-
The following example shows the top-level
settings.gradle
file, which includes two submodules.rootProject.name = 'service' include 'replace', 'run'
- The following example shows the application conversion
build.gradle
file in thereplace
submodule, which configures the JAX-RPC conversion. TheappLocation
parameter specifies the path to the application to be converted.buildscript { repositories { mavenLocal() mavenCentral() } dependencies { classpath "com.ibm.websphere.appserver.tools:liberty-jaxrpc-gradle-plugin:1.0" } } apply plugin: "com.ibm.websphere.appserver.tools.liberty-jaxrpc-gradle" group = "com.ibm.test" version = "1.0-SNAPSHOT" libertyJAXRPC { applications { DemoRPC { appLocation = file("src/test/resources/DemoRPC.war") } } }
- The following example shows the
build.gradle
file for therun
submodule.buildscript { repositories { mavenLocal() mavenCentral() } dependencies { classpath "io.openliberty.tools:liberty-gradle-plugin:3.2" } } apply plugin: "liberty" repositories { mavenLocal() mavenCentral() } dependencies { libertyApp "com.ibm.test:DemoRPC:1.0-SNAPSHOT" } liberty { server { name = "test" looseApplication = false bootstrapProperties = ['httpPort':'9080', 'httpsPort':'9443'] } } libertyStart.dependsOn "deploy" deploy.dependsOn ":replace:replaceJAXRPC" build.dependsOn 'libertyStart'
- For this multi-module project, you must define a
server.xml
file in the src/main/liberty/config directory of therun
submodule that is similar to the following example. Your application might require more features than the ones shown here. For example, client applications might need to specify thejndi-1.0
feature.<server description=”demo server”> <featureManager> <feature>localConnector-1.0</feature> <feature>servlet-4.0</feature> <feature>jaxws-2.2</feature> …. </featureManager> … <httpEndpoint id="defaultHttpEndpoint" httpPort="${httpPort}" httpsPort="${httpsPort}" /> <application name="DemoRPC" id="DemoRPC" context-root=”DemoRPC/services” location=”demo.war” type=”war”> </application> … </server>
- If you are converting and deploying an EJB application, the configuration to specify the context
root within the
application
element is slightly different. You must specify the context root within thehttp-publishing context-root
subelement, as shown in the following example.<application name=”DemoRPC" id=”DemoRPC” location=”demo.war” type=”war”> <webservices-bnd> <http-publishing context-root=”DemoRPC/services”/> </webservices-bnd> </application>
- If you are converting and deploying an EJB application, the configuration to specify the context
root within the
- To convert the application, start the Liberty and deploy the application to the server,
run the following command from the directory that defines the multi-module
project.
gradle :run:libertyStart -i -s
You can now connect your existing JAX-RPC client application to the newly deployed JAX-WS service application on Liberty, or connect your newly deployed JAX-WS client application to your existing JAX-RPC service application.