Tuesday, February 7, 2017

Creating an Oracle SOA Ant Client (for 12cR2)

Are you trying to deploy a SOA composite to a remote Oracle SOA Suite 12c environment? The annoying part is that you have to have a full blown local copy of JDeveloper or SOA Suite to do so.

These commands bring down the minimum 2.2GB to a workable 150MB of necessary JARs to allow you to do core SOA Ant tasks.

--

These commands copy files from your local SOA Suite 12.2.1 installation in $SOURCE to a $TARGET location which will be used as the middleware home for your deployments.

#----------------------------------------
# Extract only necessary JARs for SOA package/deploy
#----------------------------------------
export SOURCE=/u01/app/oracle/middleware/products/fmw1221
export TARGET=/u02/soadeploy/middleware
mkdir -p $TARGET/coherence/lib
mkdir -p $TARGET/oui/modules
mkdir -p $TARGET/osb/lib/external
mkdir -p $TARGET/wlserver/modules/
mkdir -p $TARGET/wlserver/server/lib
mkdir -p $TARGET/soa/bin
mkdir -p $TARGET/soa/soa/modules
mkdir -p $TARGET/soa/soa/modules/oracle.soa.fabric_11.1.1
mkdir -p $TARGET/soa/soa/modules/oracle.soa.mgmt_11.1.1
mkdir -p $TARGET/oracle_common/modules
mkdir -p $TARGET/oracle_common/modules/clients
mkdir -p $TARGET/oracle_common/modules/datadirect
mkdir -p $TARGET/oracle_common/modules/internal/features
mkdir -p $TARGET/oracle_common/modules/oracle.adf.share.ca
mkdir -p $TARGET/oracle_common/modules/oracle.mds
mkdir -p $TARGET/oracle_common/modules/org.apache.ant_1.9.2
mkdir -p $TARGET/oracle_common/webservices
cp $SOURCE/wlserver/modules/com.bea.core.xml.xmlbeans.jar $TARGET/wlserver/modules
cp $SOURCE/wlserver/server/lib/weblogic.jar $TARGET/wlserver/server/lib
cp $SOURCE/wlserver/server/lib/wlthint3client.jar $TARGET/wlserver/server/lib
cp $SOURCE/soa/bin/*.xml $TARGET/soa/bin
cp $SOURCE/soa/soa/modules/commons-cli-1.1.jar $TARGET/soa/soa/modules
cp $SOURCE/soa/soa/modules/oracle.soa.fabric_11.1.1/fabric-runtime.jar $TARGET/soa/soa/modules/oracle.soa.fabric_11.1.1
cp $SOURCE/soa/soa/modules/oracle.soa.fabric_11.1.1/soa-infra-tools.jar $TARGET/soa/soa/modules/oracle.soa.fabric_11.1.1
cp $SOURCE/soa/soa/modules/oracle.soa.fabric_11.1.1/testfwk-xbeans.jar $TARGET/soa/soa/modules/oracle.soa.fabric_11.1.1
cp $SOURCE/soa/soa/modules/oracle.soa.fabric_11.1.1/tracking-core.jar $TARGET/soa/soa/modules/oracle.soa.fabric_11.1.1
cp $SOURCE/soa/soa/modules/oracle.soa.mgmt_11.1.1/soa-infra-mgmt.jar $TARGET/soa/soa/modules/oracle.soa.mgmt_11.1.1
cp -Rp $SOURCE/oracle_common/modules/org.apache.ant_1.9.2/* $TARGET/oracle_common/modules/org.apache.ant_1.9.2
cp $SOURCE/oracle_common/modules/com.oracle.classloader.pcl.jar $TARGET/oracle_common/modules
cp $SOURCE/oracle_common/modules/com.oracle.webservices.fabric-common-api.jar $TARGET/oracle_common/modules
cp $SOURCE/oracle_common/modules/com.oracle.http_client.http_client.jar $TARGET/oracle_common/modules
cp $SOURCE/oracle_common/modules/org.apache.commons.beanutils_1.8.3.jar $TARGET/oracle_common/modules
cp $SOURCE/oracle_common/modules/org.apache.commons.digester_1.8.jar $TARGET/oracle_common/modules
cp $SOURCE/oracle_common/modules/org.apache.commons.logging_1.2.jar $TARGET/oracle_common/modules
cp $SOURCE/oracle_common/modules/clients/com.oracle.webservices.fmw.client.jar $TARGET/oracle_common/modules/clients
cp $SOURCE/oracle_common/modules/datadirect/fmwgenerictoken.jar $TARGET/oracle_common/modules/datadirect
cp $SOURCE/oracle_common/modules/internal/features/com.oracle.webservices.wls.wls-classpath.jar $TARGET/oracle_common/modules/internal/features
cp $SOURCE/oracle_common/modules/oracle.adf.share.ca/adf-share-base.jar $TARGET/oracle_common/modules/oracle.adf.share.ca
cp $SOURCE/oracle_common/modules/oracle.mds/mdsrt.jar $TARGET/oracle_common/modules/oracle.mds

Now that that's done, you simply now need to set your environment and point to the local copy of the minimal middleware home:

#----------------------------------------
# Target Environment Settings
#----------------------------------------
export USERNAME=weblogic
export PASSWORD=welcome1
export SOAHOST=127.0.0.1
export SOAPORT=8001
export SOAURL=http://${SOAHOST}:${SOAPORT}
export TARGET_ENV=dev

#----------------------------------------
# Set Environment
#----------------------------------------
export DEPLOY_PATH=/u02/soadeploy
export MW_HOME=/u02/soadeploy/middleware
export ORACLE_HOME=$MW_HOME/soa
export ANT_HOME=$MW_HOME/oracle_common/modules/org.apache.ant_1.9.2
export JAVA_HOME=/u01/app/oracle/middleware/products/jdk1.8.0_102
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$ANT_HOME/lib:$PATH:.

#----------------------------------------
# SOA Project Settings
#----------------------------------------
export CODE_PATH=$DEPLOY_PATH/code/TestApplication
export CODE_PROJECT=HelloWorldSOA
export CODE_REVISION=1.0
export CODE_PARTITION=default

#----------------------------------------
# SOA Build Command
#----------------------------------------
$ANT_HOME/bin/ant -f $ORACLE_HOME/bin/ant-sca-package.xml package -DcompositeDir=${CODE_PATH}/${CODE_PROJECT} -DcompositeName=${CODE_PROJECT} -Drevision=${CODE_REVISION}

#----------------------------------------
# SOA Deploy Command
#----------------------------------------
$ANT_HOME/bin/ant -f $ORACLE_HOME/bin/ant-sca-deploy.xml deploy -DserverURL=${SOAURL}/soa-infra/deployer -Duser=${USERNAME} -Dpassword=${PASSWORD} -DsarLocation=${CODE_PATH}/${CODE_PROJECT}/deploy/sca_${CODE_PROJECT}_rev${CODE_REVISION}.jar -Dpartition=${CODE_PARTITION} -Doverwrite=true -DforceDefault=true -Dconfigplan=${DEPLOY_PATH}/props/cfgplan-${TARGET_ENV}.xml

#----------------------------------------
# SOA Undeploy Command
#----------------------------------------
$ANT_HOME/bin/ant -f $ORACLE_HOME/bin/ant-sca-deploy.xml undeploy -DserverURL=${SOAURL}/soa-infra/deployer -Duser=${USERNAME} -Dpassword=${PASSWORD} -DcompositeName=${CODE_PROJECT} -Dpartition=${CODE_PARTITION} -Drevision=${CODE_REVISION}

#----------------------------------------
# SOA List Composites in Partition
#----------------------------------------
$ANT_HOME/bin/ant -f $ORACLE_HOME/bin/ant-sca-mgmt.xml listDeployedComposites -Dhost=${SOAHOST} -Dport=${SOAPORT} -Duser=${USERNAME} -Dpassword=${PASSWORD}



Applicable Versions:
    • Oracle SOA Suite 12c (12.2.1.x)



    No comments: