Note:

Deploy Oracle SOA Suite in Oracle Visual Builder Studio

Introduction

Oracle Visual Builder Studio is the official Oracle tool for automating DevOps processes with different technologies like:

This tutorial shows an example of how to implement the following functionalities in Oracle SOA Suite.

Important Note: Currently, it is only possible to implement CI/CD with Oracle SOA Suite through Oracle Visual Builder Studio. This is because only Visual Builder Studio has plug-ins already pre-installed in the virtual machine to process and compile (BUILD) the necessary packages. Therefore, it is not yet possible to implement CI/CD with other market tools such as Jenkins.

Objectives

Implement a project in SOA Suite that can be automatically deployed through the DevOps process with Oracle Visual Builder Studio.

Prerequisites

Knowledge of the following:

Task 1: Create your Oracle Streaming instance

Oracle Cloud Streaming is an application that aims to serve as a message queue just like the open-source Kafka tool. Oracle Streaming is a managed solution, meaning you create an instance for use and don’t have to worry about infrastructure governance. Pay only for what you use. The tool also allows you to use Kafka’s REST API, making it compatible with existing Kafka projects with the advantages of “cloud as a service”.

In this tutorial, we will execute a SOA service implementation to produce and another service to consume data in a message queue. So our first stop will be provisioning an Oracle Streaming environment.

Task 2: Create your SOA Suite project in JDeveloper

We will create an instance of Oracle Cloud Streaming in order to replace Kafka. Create a project with the following objectives:

The complete project is included in this tutorial. You can change the settings to compile, package and deploy to your SOA Suite instance.

Note: This tutorial does not include detailed steps to implement REST services. For more information, see How to Implement and Consume REST Services with Oracle SOA Suite.

  1. Download the SOAKafkaProducerApp project using this link: SOAKafkaProducerApp.zip.

    • Find the /SOAKafkaProducerApp/SOAKafkaProducerApp/SOAKafkaProducerApp.jws application file.

    • You can view the projects in JDeveloper: SOAKafkaProducerPrj and SOAKafkaConsumerPrj

  2. Click on the application tree and look for SOAKakfaConsumerPrj and double-click KafkaConsumer as shown in the following image.

    jdev-soa-1.png

    • This is the vision of the SOA project for Kafka queue consumption. This is a typical implementation of the SOA Composite type. This is a REST service (component laid out in the Exposed Services lane) and must be deployed on SOA Server. The component linked to the service is the implementation of the service itself and is arranged in the Components swimlane as shown in the previous image. By double-clicking on the KafkaConsumer component you will be directed to the implementation of the service as shown below:

      jdev-bpel-1.png

    • The first implementation stage starts with a component called Receive, responsible for receiving initial work parameter(s), typical of a REST call. In this tutorial, we will not pass parameters, but it is illustrated here for services that need this resource.

      jdeve-receive-1.png

      jdev-receive-detail.png

      jdev-bpel-code.png

    • The Java Embedded component is responsible for calling a Java routine that, in this case, will call a class called KafaExample commented later.

      jdev-embedded-code-1.png

    • The Java code called in this Java Embedding is responsible for the Kafka or Oracle Stream queue production and consumption routines (keep in mind that the API for Oracle Streaming is Kakfa compatible).

      java
      		package soakafka;
      
      		import org.apache.kafka.clients.consumer.ConsumerRecord;
      		import org.apache.kafka.clients.consumer.ConsumerRecords;
      		import org.apache.kafka.clients.consumer.KafkaConsumer;
      		import org.apache.kafka.clients.producer.KafkaProducer;
      		import org.apache.kafka.clients.producer.Producer;
      		import org.apache.kafka.clients.producer.ProducerRecord;
      		import org.apache.kafka.common.serialization.StringSerializer;
      		import org.apache.kafka.common.serialization.StringDeserializer;
      
      		import java.util.Arrays;
      		import java.util.Date;
      		import java.util.Properties;
      
      		import java.util.concurrent.ExecutionException;
      
      		import org.apache.kafka.clients.producer.Callback;
      		import org.apache.kafka.common.errors.WakeupException;
      
      		public class KafkaExample {
      		    private final String topic;
      		    private final Properties props;
      
      		    public KafkaExample(String brokers, String username, String password) {
      		        this.topic = "kafka_like";
      
      		        String jaasTemplate = "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"%s\" password=\"%s\";";
      		        String jaasCfg = String.format(jaasTemplate, username, password);
      
      		        String serializer = StringSerializer.class.getName();
      		        String deserializer = StringDeserializer.class.getName();
      		        //Propriedades
      		        props = new Properties();
      		        props.put("bootstrap.servers", brokers);
      		        props.put("group.id", "kafka-hoshikawa");
      		        props.put("enable.auto.commit", "false");
      		        props.put("max.poll.records", "10");
      		        props.put("auto.offset.reset", "earliest");
      		        props.put("key.deserializer", deserializer);
      		        props.put("value.deserializer", deserializer);
      		        props.put("security.protocol", "SASL_SSL");
      		        props.put("sasl.mechanism", "PLAIN");
      		        props.put("sasl.jaas.config", jaasCfg);
      		        //props.put("ssl.client.auth", "requested");
      		    }
      
      		    public String consume() {
      		        String ret = "";
      		        KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
      		        consumer.subscribe(Arrays.asList(topic));
      
      		        try {
      		          while (true) {
      		            ConsumerRecords<String, String> records = consumer.poll(100);
      		            for (ConsumerRecord<String, String> record : records)
      		            {
      		              System.out.println(record.offset() + ": " + record.value());
      		              ret = ret + record.value();
      		            }
      		              if (ret != "")
      		                break;
      		          }
      		        } catch (Exception e) {
      		          // ignore for shutdown
      		        } finally {
      		          consumer.commitAsync();
      		          consumer.close();
      		        }
      		        return ret;
      		    };
      
      		    public void produce(String message) {
      		        Producer<String, String> producer = new KafkaProducer<String, String>(props);
      		        ProducerRecord record = new ProducerRecord<String, String>(topic, "msg", message);
      
      		        Callback callback = (data, ex) -> {
      		            if (ex != null) {
      		                ex.printStackTrace();
      		                return;
      		            }
      		            System.out.println(
      		                "Mensagem enviada com sucesso para: " + data.topic() + " | partition " + data.partition() + "| offset " + data.offset() + "| tempo " + data
      		                    .timestamp());
      		        };
      		        try {
      		            producer.send(record, callback).get();
      		        } catch (ExecutionException | InterruptedException e) {
      		        }
      		        finally {
      		            producer.close();
      		        }
      		    }
      
      		    public static void main(String[] args) {
      		                /*
      				String brokers = System.getenv("CLOUDKARAFKA_BROKERS");
      				String username = System.getenv("CLOUDKARAFKA_USERNAME");
      				String password = System.getenv("CLOUDKARAFKA_PASSWORD");
      		                */
      		                String brokers = "cell-1.streaming.us-ashburn-1.oci.oraclecloud.com:9092";
      		                String username = "hoshikawaoraclecloud/oracleidentitycloudservice/hoshikawa2@hotmail.com/ocid1.streampool.oc1.iad.amaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxkgztajzakb5a";
      		                String password = "Wxxxxxxxxxxxxxxxxxxxxxxk";
      				KafkaExample c = new KafkaExample(brokers, username, password);
      		        c.consume();
      		    }
      		}
      
      		    public static void main(String[] args) {
      		                /*
      				String brokers = System.getenv("CLOUDKARAFKA_BROKERS");
      				String username = System.getenv("CLOUDKARAFKA_USERNAME");
      				String password = System.getenv("CLOUDKARAFKA_PASSWORD");
      		                */
      		                String brokers = "cell-1.streaming.us-ashburn-1.oci.oraclecloud.com:9092";
      		                String username = "hoshikawaoraclecloud/oracleidentitycloudservice/zzzzzzzzz2@zzzzzzil.com/ocid1.streampool.oc1.iad.amaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxkgztajzakb5a";
      		                String password = "Wxxxxxxxxxxxxxxxxxxxxxxk";
      				KafkaExample c = new KafkaExample(brokers, username, password);
      		        c.consume();
      		    }
      		}
      
      
      

      jdev-assign-1.png

      jdev-assign-details.png

      jdev-reply-1.png

      jdev-reply-details.png

  3. Include Java packages in your code with Maven.

    • In this project, we inject Java code to call the Kafka or Oracle Cloud Streaming API. Because it is Java code, package inclusions are often necessary to use frameworks. Maven is the most used tool in these cases and for that, you must include it in your project. With the right mouse button, open the option over your project and select From Gallery as shown in the following image.

      soa-create-pom-file.png

    • Select the Maven POM for Project option.

      soa-maven-select.png

    Now you will be able to configure your package with the necessary frameworks.

  4. Build with Maven.

    • Click on the Application Windows options and then click Directory View to access the /SOA/SCA-INF/pom.xml file.

      View-maven-pom-xml-file.png

      File-pom-xml-file2.png

    • Double-click on the pom.xml file to open it in the JDeveloper editor and select the Source tab to view the code.

    • This way you will be able to visualize the code of the pom.xml file.

      pom-xml-original.png

    • Here’s a very important change to the DevOps process. You MUST include these lines for automation.

      Note: The project in this tutorial is already configured to support DevOps automation, but for new projects, follow this procedure to automate the DevOps process. Between the tag and the tag you can include this code, which will be responsible for assembling your software package for later deployment with **Ant**.

      For DevOps automation, you need to include the following 3 lines.

      <directory>target</directory>

      <outputDirectory>classes</outputDirectory>

      <sourceDirectory>src</sourceDirectory>

      devops-pom-xml.png

      So your complete code will look like this:

      xml
          pom.xml
      
          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
      
            <groupId>soakafka</groupId>
            <artifactId>kafka</artifactId>
            <version>1.0-SNAPSHOT</version>
      
            <dependencies>
              <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>1.0.0</version>
              </dependency>
            </dependencies>
      
            <build>
      
              <!-- For DevOps automation, you need to include the 3 lines below - Cristiano Hoshikawa - 2020-11-28 -->        
              <directory>target</directory>
              <outputDirectory>classes</outputDirectory>
              <sourceDirectory>src</sourceDirectory>
      
              <plugins>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.1</version>
                  <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                  </configuration>
                </plugin>
                <plugin>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <configuration>
                    <archive>
                      <manifest>
                        <mainClass>KafkaExample</mainClass>
                      </manifest>
                    </archive>
                    <descriptorRefs>
                      <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                  </configuration>
                  <executions>
                    <execution>
                      <id>make-assembly</id> <!-- this is used for inheritance merges -->
                      <phase>package</phase> <!-- bind to the packaging phase -->
                      <goals>
                        <goal>single</goal>
                      </goals>
                    </execution>
                  </executions>
                </plugin>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-jar-plugin</artifactId>
                  <version>3.0.2</version>
                  <configuration>
                    <archive>
                      <manifest>
                        <mainClass>KafkaExample</mainClass>
                        <addClasspath>true</addClasspath>
                      </manifest>
                    </archive>
                  </configuration>
                </plugin>
              </plugins>
            </build>  
          </project>
      
      
  5. Build and Deploy with Ant.

    • Ant is a well-known tool in the market, developed by the Jakarta project, responsible for automating compilations, package builds and application deployments for projects such as Java. In the DevOps process, Ant will be fundamental for building the SOA Suite package and also for deploying this package on the remote Weblogic SOA Suite server.

    • To create your build.xml file, With the right mouse button, open the option over your project and select From Gallery as shown in the following image.

      soa-create-pom-file.png

    • Select the Ant option on the left side menu and then click Buildfile from Project.

      soa-create-ant.png

    • The build.xml file is a very common configuration file for use with Ant.

      xml
          build.xml
      
          <?xml version="1.0" encoding="UTF-8" ?>
          <!--Ant buildfile generated by Oracle JDeveloper-->
          <!--Generated Oct 12, 2020 11:35:33 PM-->
          <project xmlns="antlib:org.apache.tools.ant" name="SOAKafkaProducerPrj" default="all" basedir=".">
            <property environment="env" />
            <property file="build.properties"/>
            <path id="library.SOA.Designtime">
              <pathelement location="${install.dir}/soa/plugins/jdeveloper/extensions/oracle.sca.modeler.jar"/>
            </path>
            <path id="library.SOA.Runtime">
              <pathelement location="${install.dir}/soa/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar"/>
              <pathelement location="${install.dir}/soa/soa/modules/oracle.soa.fabric_11.1.1/tracking-api.jar"/>
              <pathelement location="${install.dir}/soa/soa/modules/oracle.soa.fabric_11.1.1/tracking-core.jar"/>
              <pathelement location="${install.dir}/soa/soa/modules/oracle.soa.fabric_11.1.1/edn.jar"/>
              <pathelement location="${install.dir}/soa/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar"/>
              <pathelement location="${oracle.commons}/modules/com.oracle.webservices.fabric-common-api.jar"/>
            </path>
            <path id="library.BPEL.Runtime">
              <pathelement location="${install.dir}/soa/soa/modules/oracle.soa.bpel_11.1.1/orabpel.jar"/>
            </path>
            <path id="library.Mediator.Runtime">
              <pathelement location="${install.dir}/soa/soa/modules/oracle.soa.mediator_11.1.1/mediator_client.jar"/>
            </path>
            <path id="library.MDS.Runtime">
              <pathelement location="${oracle.commons}/modules/oracle.mds/mdsrt.jar"/>
            </path>
            <path id="library.BC4J.Service.Runtime">
              <pathelement location="${oracle.commons}/modules/oracle.adf.model/adfbcsvc.jar"/>
              <pathelement location="${oracle.commons}/modules/oracle.adf.model/adfbcsvc-share.jar"/>
              <pathelement location="${oracle.commons}/modules/commonj.sdo.backward.jar"/>
              <pathelement location="${oracle.commons}/modules/commonj.sdo.jar"/>
              <pathelement location="${oracle.commons}/modules/oracle.toplink/eclipselink.jar"/>
              <pathelement location="${oracle.commons}/modules/com.oracle.webservices.fmw.wsclient-impl.jar"/>
              <pathelement location="${oracle.commons}/modules/com.oracle.webservices.fmw.jrf-ws-api.jar"/>
              <pathelement location="${oracle.commons}/modules/com.oracle.webservices.fmw.web-common-schemas-impl.jar"/>
            </path>
            <path id="classpath">
              <path refid="library.SOA.Designtime"/>
              <path refid="library.SOA.Runtime"/>
              <path refid="library.BPEL.Runtime"/>
              <path refid="library.Mediator.Runtime"/>
              <path refid="library.MDS.Runtime"/>
              <path refid="library.BC4J.Service.Runtime"/>
            </path>
            <target name="init">
              <tstamp/>
              <mkdir dir="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj/SOA/SCA-INF/classes"/>
            </target>
            <target name="all" description="Build the project" depends="deploy,copy"/>
            <target name="clean" description="Clean the project">
              <delete includeemptydirs="true" quiet="true">
                <fileset dir="${output.dir}" includes="**/*"/>
              </delete>
            </target>
            <target name="compile" depends="init">
                <javac
                         srcdir="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj/SOA/SCA-INF/src/soakafka"
                         destdir="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj/SOA/SCA-INF/classes"
                     includeantruntime="false">
                     <include name="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj/SOA/SCA-INF/lib/**"/>
              </javac>
            </target>
            <target name="sca-compile" depends="compile">
                <ant antfile="${middleware.home}/soa/bin/ant-sca-compile.xml" inheritAll="false">
                     <property name="scac.input" value="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj/SOA/composite.xml"/>
                </ant>
            </target>
      
            <target name="sca-package" depends="sca-compile">
                <ant antfile="/${middleware.home}/soa/bin/ant-sca-package.xml" inheritAll="false">
                     <property name="compositeDir" value="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj/SOA"/>
                    <property name="compositeName" value="SOAKafkaProducerPrj"/>
                    <property name="revision" value="${revision}"/>
                    <property name="sca.application.home" value="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj"/>
                </ant>
            </target>
      
            <target name="deploy" description="Deploy JDeveloper profiles" depends="sca-package">
              <taskdef name="ojdeploy" classname="oracle.jdeveloper.deploy.ant.OJDeployAntTask" uri="oraclelib:OJDeployAntTask"
                       classpath="${oracle.jdeveloper.ant.library}"/>
              <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask" executable="${oracle.jdeveloper.ojdeploy.path}"
                            ora:buildscript="${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml"
                            ora:statuslog="${oracle.jdeveloper.deploy.dir}/ojdeploy-statuslog.xml">
                <ora:deploy>
                  <ora:parameter name="workspace" value="${oracle.jdeveloper.workspace.path}"/>
                  <ora:parameter name="project" value="${oracle.jdeveloper.project.name}"/>
                  <ora:parameter name="profile" value="${oracle.jdeveloper.deploy.profile.name}"/>
                  <ora:parameter name="nocompile" value="false"/>
                  <ora:parameter name="outputfile" value="${oracle.jdeveloper.deploy.outputfile}"/>
                </ora:deploy>
              </ora:ojdeploy>
      
               <!-- Deployment SOA Suite Composite -->
              <ant antfile="/${middleware.home}/soa/bin/ant-sca-deploy.xml" target="deploy" inheritall="false">
                <property name="user"      value="${WEBLOGICUSER}"/>
                <property name="password"  value="${WEBLOGICPWD}"/>
                <property name="serverURL"     value="${WEBLOGICURL}"/>
                <property name="sarLocation"   value="${workspace}/SOAKafkaProducerApp/SOAKafkaProducerPrj/SOA/deploy/sca_SOAKafkaProducerPrj_rev${revision}.jar"/>
                <property name="overwrite"     value="true"/>
              </ant>
      
            </target>
            <target name="copy" description="Copy files to output directory" depends="init">
              <patternset id="copy.patterns">
                <include name="**/*.GIF"/>
                <include name="**/*.JPEG"/>
                <include name="**/*.JPG"/>
                <include name="**/*.PNG"/>
                <include name="**/*.cpx"/>
                <include name="**/*.dcx"/>
                <include name="**/*.ejx"/>
                <include name="**/*.gif"/>
                <include name="**/*.ini"/>
                <include name="**/*.jpeg"/>
                <include name="**/*.jpg"/>
                <include name="**/*.png"/>
                <include name="**/*.properties"/>
                <include name="**/*.sva"/>
                <include name="**/*.tag"/>
                <include name="**/*.tld"/>
                <include name="**/*.wsdl"/>
                <include name="**/*.xcfg"/>
                <include name="**/*.xlf"/>
                <include name="**/*.xml"/>
                <include name="**/*.xsd"/>
                <include name="**/*.xsl"/>
                <include name="**/*.exm"/>
                <include name="**/*.xml"/>
                <exclude name="build.xml"/>
              </patternset>
              <copy todir="${output.dir}">
                <fileset dir="SOA/SCA-INF/src">
                  <patternset refid="copy.patterns"/>
                </fileset>
                <fileset dir=".">
                  <patternset refid="copy.patterns"/>
                </fileset>
              </copy>
            </target>
          </project>
      
      
    • The build.properties file determines the properties that will be used in the build.xml configuration file.

      build.properties
      
      oracle.commons=../../../../oracle_common/
      install.dir=../../../..
      oracle.home=${env.ORACLE_HOME_SOA_12_2_1}
      oracle.jdeveloper.workspace.path=${env.WORKSPACE}/SOAKafkaProducerApp/SOAKafkaProducerApp.jws
      middleware.home=${env.MIDDLEWARE_HOME_SOA_12_2_1}
      workspace=${env.WORKSPACE}
      oracle.jdeveloper.ant.library=${env.ORACLE_HOME_SOA_12_2_1}/jdev/lib/ant-jdeveloper.jar
      oracle.jdeveloper.deploy.dir=${env.WORKSPACE}/SOAKafkaProducerApp/SOAKafkaProducerPrj/deploy
      oracle.jdeveloper.ojdeploy.path=${oracle.home}/jdev/bin/ojdeploy
      javac.nowarn=off
      oracle.jdeveloper.project.name=SOAKafkaProducerPrj
      revision=1.0
      oracle.jdeveloper.deploy.outputfile=${env.WORKSPACE}/SOAKafkaProducerApp/SOAKafkaProducerPrj/deploy/sca_${profile.name}_rev{$revision}
      output.dir=classes
      javac.deprecation=off
      oracle.jdeveloper.deploy.profile.name=*
      javac.debug=on
      WEBLOGICPWD=${env.WEBLOGICPWD}
      WEBLOGICURL=${env.WEBLOGICURL}
      WEBLOGICUSER=${env.WEBLOGICUSER}
      
      
  6. Initialize the SOA Suite environment for test. First open the firewall port of your SOA Suite environment. The port to be released is 9092, which represents the Oracle Streaming or Kafka port.

  7. Enable Embedded SOA Server in JDeveloper.

    • JDeveloper has an integrated SOA Suite server for development and testing. It is a server with practically all the functionalities necessary for you to develop your SOA services. In order to use this server, you must create and activate it.

    • To activate the server, you first need to view the application servers. For this, go to the “Window” option and select Application Servers as shown in the following image.

      jdeveloper-select-app-server.png

    • The application servers window will appear on the left side of the screen. Make sure the integratedWeblogicServer is already created in your window. If not, you’ll need to create it and then activate it for use.

    • Go to the Run option and select Start Server Instance as shown in the following image.

      jdev-start-app-server.gif

    • Enter the required data to create your weblogic instance. Write down the values ​​as you will need them later for testing.

      jdev-create-app-server.gif

    • If you created the server or if it was already available, right-click on your server and activate it as shown in the following image.

      jdeveloper-start-app-server.png

  8. Run a Manual Deployment in SOA Suite.

    • First, let’s perform the deployment of your Kafka consumer service (SOAKafkaConsumerPrj) manually. To do so, locate your Applications tab and open the menu options with the right mouse button, as shown in the following image.

      soa-deploy-1.png

    • Select the Deploy option and then create a new deployment profile. You will see a configuration screen and you must choose the type of profile as SOA-SAR File as we will generate a file.

      soa-deploy-2.png

    • This is preparation for us to be able to deploy your package in the next step. On the next screen, keep the given options and click OK.

      soa-deploy-3.png

    • Open the Deploy menu option again. The deployment option is created and ready to use. Select it.

      soa-deploy-4.png

    • Now let’s choose the option to deploy directly to your SOA server. Then choose the option as shown below.

      soa-deploy-5.png

    • Leave all options provided and select Overwrite any existing composites with the same revision ID. If this option is unchecked and you try to perform consecutive deployments after your first run, you will be interrupted with an error message.

      soa-deploy-6.png

    • Then select the IntegratedWeblogicServer option. This option represents JDeveloper’s embedded server explained in the previous section (How to enable Embedded SOA Server in JDeveloper).

    • If your JDeveloper Weblogic server was successfully created and started, you will see the option below and the “RUNNING” status confirming that everything is OK. If you don’t see this option, you probably haven’t created the server yet or haven’t started it. Review the previous steps.

      soa-deploy-9.png

    • Confirm with Next until the summary screen and click Finish.

    • In the bottom center window, you can follow the deployment of your application. Wait until you see Deploy finished as success message.

      soa-deploy-11.png

  9. Install the JKS certificate in Weblogic.

    • In SSL environments, it will be necessary to create security through keys (public/private) which will be done through JKS certificates, suitable for the WebLogic environment. The key generation process is done by obtaining the certificate of your Oracle Cloud Streaming instance and adding this certificate to a JKS file, which we will call DemoTrust (DemoTrust.jks).

      Note: The DemoTrust.jks file will be stamped with an ALIAS as well as a password which will be used in your Java code.

    • After creating your JKS file, you can move this file into your WebLogic server structure.

      1. Get the Oracle Cloud Streaming Certificate. For more information, see Using the Oracle Cloud Infrastructure Streaming Service Adapter with Oracle Integration Generation 2.

      2. Generate the JKS file.

      3. Install the JKS file in Weblogic.

        echo -n | openssl s_client -connect cell-1.streaming.us-ashburn-1.oci.oraclecloud.com:9092 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ociStreaming.cert keytool -keystore Streaming_truststore.jks -alias OSSStream -import -file ociStreaming.cert

        sudo keytool -importcert -file ociStreaming.cert -keystore DemoTrust.jks -alias "kafka" -storepass DemoTrustKeyStorePassPhrase

        For example:

        echo -n | openssl s_client -connect cell-1.streaming.us-ashburn-1.oci.oraclecloud.com:9092 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ociStreaming.cert keytool -keystore Streaming_truststore.jks -alias OSSStream -import -file ociStreaming.cert

        sudo keytool -importcert -file ociStreaming.cert -keystore DemoTrust.jks -alias "kafka" -storepass DemoTrustKeyStorePassPhrase

        • If you want to generate or delete keystores by alias, follow these steps:

          shell
              sudo keytool -import -v -file streaming.us-ashburn-1.oci.oraclecloud.com.cer -storepass changeit -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre/lib/security/cacerts -alias "kafka"
          
              sudo keytool -delete -alias kafka -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit
          
              sudo keytool -import -v -file streaming.us-ashburn-1.oci.oraclecloud.com.cer -keystore DemoTrust.jks -alias "kafka" -storepass DemoTrustKeyStorePassPhrase
          
              sudo keytool -delete -alias kafka -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase
          
        • Find your wlserver folder which usually has this path: /wlserver/server/lib. For example: cd /u01/app/oracle/middleware/wlserver/server/lib, cd /User/u01/Oracle/Middleware/Oracle_Home/wlserver/server/lib

        • Replace the DemoTrust.jks file with the one generated in this step.

        • After copying the DemoTrust.jks file, you must change the directory where you deployed the file. Change the /src/soakafka/KafkaExample.java files of both projects (SOAKafkaProducerprj and SOAKafkaConsumerprj) when creating the class as follows:

          change-truststore-soa-1.png

  10. Test the application.

    • After uploading the test environment, your instance will be available at: http://localhost:7101/em.

    • Remember your username and password.

    • Go to your application under SOA menu item and Deployed Components option.

      soa-test-5.png

    • Fill in the message parameter required by the service, as per the implementation. This parameter was called “msg” and the message format is JSON according to the previous steps.

      soa-test-producer-1a.png

    • After entering your message in JSON format, click “Test Web Service” to run your Producer service on the message queue.

      soa-test-producer-2.png

Task 3: Create a SOA Suite Instance on Oracle Cloud

You must have an active instance of Oracle SOA Suite for your application to be deployed. The instance to be used in this tutorial will be the image available on our Marketplace and will have a SOA Suite structure served by a bastion to protect the server.

  1. For this, let’s create an instance. In the Oracle Cloud console , click on the main menu (in the upper left corner of the screen), option “Marketplace” and “All Applications” as below:

    market-place.png

  2. In the image search screen, type “soa suite” to find the correct image:

    marketplace-soa-suite.png

  3. Click on the “Oracle SOA Suite (BYOL)” option to start creating the instance. You will see some mandatory options to select. For more information, see Using Oracle SOA Suite on Marketplace in Oracle Cloud Infrastructure.

    • Confirm SOA Suite version: 12.2.1.4 or higher (this workshop was developed with version 12.2.1.4).

    • Select the compartment in which you want the SOA Suite instance to be created.

    • Confirm acceptance of the terms and conditions of the licensing agreement.

    • Click Launch Stack.

      soa-suite-creation.png

  4. From the Oracle Cloud console main menu, go to Compute and Instances.

    compute-select.png

  5. Select the compartment where you created your SOA Suite instance and when you select it you will see 2 virtual machines.

    • The SOA Suite Server
    • The VM that will serve as a bastion for protecting the SOA Suite server

    Note: The VM bastion will have a public IP, which it will be possible to access via the Internet to access the SOA Suite server by opening an IP tunnel, explained later.

    instance-soa-suite-compute.png

  6. To establish a tunnel between the Bastion Server and the SOA Suite instance, you can do it through the SSH command as below:

    shell
        ssh -Y -i <Arq.Chave SSH> -L <Port SOA>:<IP Instance SOA Suite>:<Port External> opc@<IP Public Bastion>
    
        Example:
        ssh -Y -i keyrvbastion.pem -L 7002:10.253.128.9:7002 opc@152.67.55.11
    
    

    After establishing the connection via Bastion, you can access the Weblogic Enterprise Manager with http://localhost:7002/em.

Task 4: Automate the deployment with Oracle Visual Builder Studio

Now let’s automate the deployment of SOA implementations to the Weblogic server created in the previous step. For this you will need an instance of Oracle Visual Builder Studio. Oracle Visual Builder Studio works by projects, so you can create a project and include the users that will take part in its execution.

You can find more information about the operation in the Related Links section at the end of this document, search for Deploy with Visual Builder Studio. Next, follow the steps to configure an automated build and deployment of your SOA Suite implementations to the Weblogic server.

  1. Configure a virtual machine for BUILD in ORACLE SOA Suite. Before starting the settings, you will need to configure a virtual machine that meets the needs of compiling an Oracle SOA Suite project , for this, you will need to select the correct tools to be installed in this VM.

    1. Click Organization on the left side menu and then click Virtual Machine Templates.

      vbst-create-template.png

    2. Click Create Template to configure which tools will be available for building your SOA Suite projects. Then type a name for your Template and if you want, optionally, you can describe about this template. Don’t forget to select which platform this VM will be on. Choose the Oracle Linux option (until the date of this document, we had Oracle Linux 7, but you can select another more recent option.

      vbst-create-template-2.png

    3. Select all the important components for building your projects. Choose all the options as below.

      vbst-config-sw.png

      vbst-config-details.png

      Your TEMPLATE is created and your VM will be instantiated as soon as a project asks for a build.

    4. BUILD configuration of a project in Oracle Visual Builder Studio. First, open a project within Oracle Visual Builder Studio, in the example below, click on CRISTIANO HOSHIKAWA PROJ.

      main-visual-builder-studio.png

      • You will see your project page, along with a left side menu with the available options and on the right side your projects in the source code repository and also the team that is part of this project (project users).

        visual-builder-studio-project.png

    5. Click on the BUILD option on the left side menu to view all existing settings and then let’s configure a new BUILD for your project. Click Create Job.

      visual-builder-studio-create-job.png

    6. Enter a name for your Job and also select the VM Template (created in the previous session).

      vbst-create-job-details.png

  2. Now let’s configure the build of your project step-by-step. The first part of the configuration will be to establish the repository of the Oracle SOA Suite project that must be previously created with the source code. In this document, we are working with the SOAKafkaProducerApp project available in the git of this document. You will be able to clone this project to the git of your Oracle Visual Builder Studio instance .

    1. After cloning the SOAKafkaProducerApp project to your Visual Builder Studio, configure your BUILD with the name of the git repository and select the option “Automatically perform build on SCM commit”. Also check that the branch name matches your git project.

      vbst-git.png

    2. Now select the “Parameters” tab. You will have to create 3 parameters with the Combobox menu “Add Parameters” on the right side. Below, the names that must be created and also in parentheses, the type:

      • WEBLOGICUSER: the Weblogic user (String type)

      • WEBLOGICPWD: your Weblogic user password (type Secret/Password)

      • WEBLOGICURL: the URL of your Weblogic instance (String type)

      • An important observation is that the URL in WEBLOGICURL must be localhost as a tunnel will be established through the Bastion Server

        vbst-parameters.png

    3. Now click on the “Before Build” tab to configure the SSH tunnel from the Bastion Server to the Weblogic SOA Suite Server. Remember to have your SSH key (Private Key) and fill in the corresponding field. Fill in the data for the tunnel assembly.

      • Username: opc

      • Local Port: 11002

      • Remote Host: Private IP of your SOA Suite instance

      • Remote Port: 11002

      • SSH Server: Public IP of your Bastion

      • An important observation is that port 11002 was previously configured so that it is exactly the access port for deploying your SOA Suite projects.

        vbst-tunnel.png

    4. Click on the “Steps” tab to configure BUILD (via Maven) and DEPLOYMENT (via ANT) of your SOA Suite project. Fill in as follows:

      • MAVEN
      • Goals: compile package

      • POM File: SOAKafkaProducerApp/SOAKafkaConsumerPrj/SOA/SCA-INF/pom.xml. This is the Maven pom.xml file for assembling your project package

      • ANT

        • Targets: sca-package deploy

        • Build File: SOAKafkaProducerApp/SOAKafkaConsumerPrj/build.xml. This is the Ant build.xml file for deploying your application after build.

      • Properties

        • WEBLOGICUSER=${WEBLOGICUSER}

        • WEBLOGICPWD=${WEBLOGICPWD}

        • WEBLOGICURL=${WEBLOGICURL}

      Important Note:

      • The SOAKafkaProducerApp application has 2 projects: SOAKafkaProducerPrj and SOAKafkaConsumerPrj.

      • We are illustrating the configuration of one of the projects. The same steps must be performed for the other project.

      vbst-config-step.png

    5. Now let’s finish the BUILD configuration. Select the “After Build” tab. This step is optional, however you may want to generate the artifact created by the previous step when running Maven. For this, configure this step so that the artifact is generated for later download.

      vbst-after-build.png

  3. Execute the BUILD in Oracle Visual Builder Studio. Once configured, every time there is a commit in your code repository (Visual Builder Studio git), the BUILD will start automatically. You can also run the BUILD manually, for this you just have to click on the BUILD option. Try running BUILD and you will be able to check the generated Logs.

    vbst-log-1.png

    vbst-logs-3.png

    vbst-logs-2.png

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.