Running Oracle SOA Suite on Docker - Part 2: Installing a docker host

Running Oracle SOA Suite on Docker - Part 2: Installing a docker host

Johannes Michler PROMATIS Horus Oracle


Executive Vice President – Head of Platforms & Development

Operating - installing and maintaining Oracle Fusion Middleware, especially Oracle SOA Suite 12.2.1.4 is quite some work. Not only does installation itself consist of a number of steps, but each quarterly critical patch update also requires applying a number of patches and especially in simple, single server environments quite some downtime.

This blog post series will cover how to run Oracle Fusion Middleware especially Oracle SOA Suite on docker. The first post covered the high-level steps of manual installation, Docker and Kubernetes options and has pointers to the relevant Oracle certification documentation.

This second post will then describe how using OCI and Oracle Linux a host to run docker containers can be setup up within minutes.

In upcoming posts I will then cover provisioning an Oracle Database instance to hold the meta data of Oracle SOA Suite. In the 4th episode I will look into provisioning and configuring SOA Suite itself. While I will first show those steps in a minimalistic way, to wrap up, the final episodes will cover patching and more advanced deployment options.

Runtime environment - here Oracle Cloud Infrastructure (OCI)

While there are options to running containers in OCI in a managed fashion, e.g. using the Oracle Container Engine for Kubernetes or Oracle Container Instances, the most flexible and often cheapest option to run docker on OCI is by leveraging Virtual Machines. For the purpose of this blog, I've created a new virtual machine in a public network subnet (so it is directly accessible through the internet) as follows:

Creation of a docker-test virtual machine with Oracle Linux 8

In general, "bursting" (so over-subscribing) is a helpful feature to reduce costs; however keep in mind that this is not a good idea when using software that is licensed "by processor core":

Flexible selection of an appropriate compute shape

Installation of docker

After creating the virtual machine ssh into the newly created instance and install docker as follows. If you increased the boot volume size grow the file system appropriately:

ssh opc@193.1.2.3sudo dnf upgradesudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.reposudo dnf install docker-ce --nobestsudo systemctl enable docker.servicesudo systemctl start docker.servicegrowpart /dev/sda 3sudo lvextend -l +100%FREE /dev/ocivolume/rootxfs_growfs /df -h / -- should show 88gbsudo reboot
# For UI start of config tools later:dnf install xauth xterm

After having installed docker itself you can perform a quick test e.g. as follows:

docker run hello-world

This should download and start the hello-world docker container similar to the following screenshot:


First start of the hello-world container

    Summary

    As shown creating a docker host e.g. on OCI is straightforward. In the next section of the blog, we'll see how we can run an Oracle Database on this Docker host.

    Exposing NULL values and Booleans in JSON/REST with Oracle SOA Suite

    Exposing NULL values and Booleans in JSON/REST with Oracle SOA Suite

    Johannes Michler PROMATIS Horus Oracle


    Executive Vice President – Head of Platforms & Development

    Recently we had a couple of projects where we needed to expose data extracted from an Oracle Database through a simple SQL query as a REST service producing JSON. Let’s have a look at how it is possible to control the JSON produced in such a scenario.

    Implementation

    The composite is very, very trivial:


    Composite in SOA Suite

    It just maps two URL query parameters to the WHERE condition of the SQL query:


    REST Service Configuration

    When the service is invoked, unfortunately, the JSON returned is not really “optimal”:

    {
    "XxisBlanketMatkoV" : [ {
    "lineId" : 278000,
    "shipSiteAddress1" : "PROMATIS software GmbH",
    "shipSiteAddress2" : "Pforzheimer Str. 160",
    "shipSiteAddress3" : {
    "@nil" : "true"
    },
    "shipSiteAddress4" : {
    "@nil" : "true"
    },
    "shipSiteCountry" : "DE",
    "shipSitePlz" : "76275",
    "bulkFlag" : "N"
    } ]
    }

    Issues with initial version

    This is ugly for two reasons:

    • One usually does not describe NULL values in JSON like that. It would be better to either “omit” the element “shipSiteAddress3” or have them set to “shipSiteAddress3”: null.
    • bulkFlag is a boolean, it would be better to have this as “bulkFlag” : false.

    Of course, there is an obvious solution to this: Just add a mediator or even a BPEL process and do an XSLT transformation from the data from the Database Adapter to an explicit schema, and one can map Y/N to true/false over an xsl:if and is additionally able to e.g. omit the NULL elements based on xsl:if.

    However, this is “one more thing” to maintain, and if the base SELECT changes, this transformation has to be adapted as well.

    Producing better “null” values

    Obviously, SOA Suite first extracts the data from the database column SHIP_SITE_ADDRESS4 (which in NULL) to an xml representation of

    <shipSiteAddress3 xsi:nil=”true”/> and then translates that attribute into a json child “@nil”=true.

    Luckily in the meantime, SOA Suite got a patch 31926382 (which is part of SOA Bundle Patch 12.2.1.4.221122). With that patch, according to 2764402.1, one is able to modify the XSD that defines the XML elements that in the end are converted to JSON as follows:


    Modified XML Schema

    just add:

    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" nxsd:version="JSON" nxsd:encoding="UTF-8" nxsd:isNillableSupported="true"

    and the @nil will be converted to “proper” null values.

    true and false

    Unfortunately, pure (Oracle) SQL does not support boolean data types in the database so far. This also makes it a bit difficult to produce true/false when fetching data through the JCA Database adapter of SOA Suite. I managed to fix this by doing the following:

    1. Returning 0 for false and 1 for true in the SQL field of “bulk_flag,
    2. modifying the or-mappings.xml to:
    <attribute-mapping xsi:type="direct-mapping"
    <attribute-name>bulkFlag</attribute-name>
    <field table="XXIS_BLANKET_MATKO_V" name="BULK_FLAG" xsi:type="column"/>
    <attribute-classification>java.lang.Boolean</attribute-classification>
    </attribute-mapping>>

    (Thus changing it from java.lang.Decimal to java.lang.Boolean.)

    Summary: Prettier JSON

    By implementing these two tiny changes:

    • Add nxsd:isNillableSupported=”true” to schema,
    • modify the or-mappings.xml to have <attribute-classification>java.lang.Boolean</attribute-classification> to

    The REST service gives us:

    {
    "XxisBlanketMatkoV" : [ {
    "lineId" : 278000,
    "shipSiteAddress1" : "PROMATIS software GmbH",
    "shipSiteAddress2" : "Pforzheimer Str. 160",
    "shipSiteAddress3" :null,
    "shipSiteAddress4" : null,
    "shipSiteCountry" : "DE",
    "shipSitePlz" : "76275",
    "bulkFlag" : false
    } ]
    }

    Which is way better JSON ?