4 Integrating WebLogic Server Web Services with Helidon

The Oracle WebLogic Server (WebLogic Server) Web Services integration with Helidon enables a Helidon client to call on the WebLogic Server Web Services. This integration allows the Helidon microservices to interact with the WebLogic Server applications by using the SOAP Web Service calls from Helidon to WebLogic Server.

The following graphics illustrate the integration between WebLogic Server Web Services and Helidon:

Figure 4-1 Web Services Integration with Helidon



This chapter includes the following topics:

Prerequisites

To integrate WebLogic Server with Helidon for SOAP (Simple Object Access Protocol) Web Services, it is assumed that you have already deployed WebLogic Server and Helidon in a Kubernetes cluster. See Preparing the Kubernetes Cluster for WebLogic Server and Helidon Integration.
In addition, obtain the following jar files provided by WebLogic Server:

Setting Up the Web Services Integration with Helidon

WebLogic Server Web Services and Helidon integration enables the Helidon microservice application to communicate with the WebLogic Web Service deployed in WebLogic Server. Before you begin the integration steps, you should have created the JAX-WS Web Service using WebLogic Deploy Tooling (WDT) and included it as part of an auxiliary image. See Auxiliary Images. For information about developing WebLogic Server Web Services, see Examples of Developing JAX-WS Web Services in Developing JAX-WS Web Services for Oracle WebLogic Server.
To initiate a call from Helidon to an existing WebLogic Server Web Service:
  1. Install the client jar file and include it as part of the Maven dependencies, as shown below:
    If you are using Helidon 3.x, install the com.oracle.webservices.wls.jaxws-wlswss-client.jakarta.jar client jar file, as shown below:
    <dependency>
        <groupId>com.oracle.webservices.wls.jaxws-wlswss-client.jakarta</groupId>
        <artifactId>com.oracle.webservices.wls.jaxws-wlswss-client.jakarta</artifactId>
        <version>1.0</version>
    </dependency>
    If you are using Helidon 2.x, install the com.oracle.webservices.wls.jaxws-wlswss-client.jar client jar file, as shown below:
    <dependency>
        <groupId>com.oracle.webservices.wls.jaxws-wlswss-client</groupId>
        <artifactId>com.oracle.webservices.wls.jaxws-wlswss-client</artifactId>
        <version>1.0</version>
    </dependency>
  2. Use the clientgen WebLogic Server Web Services Ant task from the client jar file installed in Step 1 to generate the artifacts that client applications need. These artifacts are generated and added to the target/generated-sources folder.

    Add the maven-antrun-plugin plug-in to execute the clientgen Ant task during the generate-sources build phase, as shown in the following example:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
            <execution>
                <id>ws-client-gen</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>run</goal>
                </goals>
                <configuration>
                    <target>
                        <property name="wsdl-file">file://${basedir}/DynamicWSImplService.wsdl</property>
                        <property name="compile_classpath"
                                  refid="maven.compile.classpath"/>
                        <taskdef name="clientgen"
                                 classname="weblogic.wsee.tools.anttasks.ClientGenTask"
                                 classpath="${compile_classpath}"/>
                        <clientgen wsdl="${wsdl-file}"
                                   wsdlLocation="${wsdl-file}"
                                   destDir="${project.build.directory}/generated-sources"
                                   packageName="com.example.wlssoap"
                                   generateRuntimeCatalog="false"
                                   type="JAXWS"
                                   copyWsdl="false"/>
                    </target>
                </configuration>
            </execution>
        </executions>
    </plugin>

    For more information about generating client artifacts, see Using the clientgen Ant Task To Generate Client Artifacts.

  3. Use the build-helper-maven-plugin plug-in to add the /target/generated-sources directory with the generated client classes as an additional directory with sources.
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
            <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                    <goal>add-source</goal>
                </goals>
                <configuration>
                    <sources>
                        <source>${pom.basedir}/target/generated-sources</source>
                    </sources>
                </configuration>
            </execution>
        </executions>
    </plugin>
  4. Create the Jakarta based (for Helidon 3.x) or javax based (for Helidon 2.x) RESTful Web Service to invoke the WebLogic Web Service with the generated client classes, as shown in the following example.
    @Path("/helidon-client")
    @ApplicationScoped
    public class HelidonWSEEClient {
    
        @Inject
        @ConfigProperty(name = "remote.wsdl.location")
        private String remoteWsdlLocation;
    
        @GET
        @Path("/getWLSWebserviceResult/subtract/{y}/from/{x}")
        @Produces(MediaType.APPLICATION_JSON)
        public JsonObject invokeWLSWebservice(@PathParam("x") int x,
                                              @PathParam("y") int y) {
            DynamicWSImplService testService = new DynamicWSImplService();
            DynamicWSImpl testPort = testService.getDynamicWSImplPort();
            ((BindingProvider) testPort).getRequestContext()
                    .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, remoteWsdlLocation);
    
            int response = testPort.subtract(x,y);
    
            return Json.createObjectBuilder().add("ws-response", response).build();
        }
    }
  5. Build the Helidon client and invoke the WebLogic Server Web Service by compiling the Maven REST client using the following command:
    mvn clean package
  6. Start the Helidon server using the following command:
    java -jar target/<Helidion-Project-Name>.jar

    When the Helidon server starts, the microservice gets deployed and becomes ready for use. You can access the microservice application locally by using the http://<HELIDON_HOST>:<HELIDON_PORT>/helidon-client/getWLSWebserviceResult/subtract/5/from/10 URL.

    Where <HELIDON_HOST> and <HELIDON_PORT> refer to the host where the Helidon microservice application is running.