Saturday, 27 December 2014

Create 12c SOA Application and SOA Project by using Maven


Create SOA Application and SOA Project by using Maven

Prerequisite: Maven setup in Jdeveloper 12c

To use maven to create SOA application and SOA project we should setup maven in developer machine.

Step1: In cmd prompt, setup below env variables
                set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
                set PATH=%JAVA_HOME%\bin;%PATH%
                set ORACLE_HOME=D:\Fusion12C\Oracle\Middleware\Oracle_Home
                set M2_HOME=<ORACLE_HOME>\oracle_common\modules\org.apache.maven_3.0.5
                set PATH=%M2_HOME%\bin;%PATH%

Step2: Run below mvn cmd to create soa application and soa project.
mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.1.3-0-0 -DarchetypeRepository=local

Fill below details in CMD prompt:
[INFO] Generating project in Interactive mode
[INFO] Archetype defined by properties
Define value for property 'groupId': : com.test
Define value for property 'artifactId': : SOA12cApplicationWithMVN
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  com.test: :
[INFO] Using property: adf = .adf
[INFO] Using property: data = .data
Define value for property 'projectName': : SOA12cProjectWithMVN
Confirm properties configuration:
groupId: com.test
artifactId: SOA12cApplicationWithMVN
version: 1.0-SNAPSHOT
package: com.test
adf: .adf
data: .data
projectName: SOA12cProjectWithMVN
Y: :Y

NOTE: If first time you are running "generate" maven goal then you may get error says that "maven goal or respective POM file is not available in maven repositery". If you see this kind of error then execute below maven goal. Below mvn cmd will download all required mvn jar files and pom files.
--> mvn archetype:generate

Step3: If we observe physical folders where we created SOA application and SOA Project , we dont have .jws and .jpr files.
Step4: Now open SOA application in JDeveloper 12c by following below steps.





Now we can see SOA application and SOA project in Jdeveloper12c.
We can see .jws and .jpr files in physical file system.


Step5: Now we can implement required business logic in composite.

Step6: Once we create required business logic we can deploy soa project in to SOA server.
For deployment we can use traditional deployment process by using jdeveloper.
In this post i want to show you steps to deploy soa project with maven goal.

--> mvn pre-integration-test

NOTE: If you are using this mvn cmd first time then it will download all required prerequisite jars and pom files.

If you get this kind of error, then you have to modify project level pom file with required server properties as shown below.

Modify the server details in your project level pom file, in which server you want to deploy the program. I am using integrated SOA server in JDeveloper so i provided local host details, you should provide as per your server environment.

NOTE:
Project level pom file available in "<mywork>\<application name>\<project name>\pom.xml"

Now run the mvn cmd to deploy SOA project.
--> mvn pre-integration-test

Step7: We can see deployed soa project in enterprise manager.




Maven Set up in JDeveloper 12C

Maven Set up in JDeveloper 12C

Prerequisites : First we should install JDK 1.7 and JDeveloper 12.1.3.0.0

Step1: open cmd prompt

Step2: set environment variables in cmd prompt
        set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
        set PATH=%JAVA_HOME%\bin;%PATH%
        set ORACLE_HOME=D:\Fusion12C\Oracle\Middleware\Oracle_Home
        set M2_HOME=<ORACLE_HOME>\oracle_common\modules\org.apache.maven_3.0.5
        set PATH=%M2_HOME%\bin;%PATH%
NOTE: set the variables as per your machine.

Step3: Now we need a way to get the necessary artifacts into developers machines local Maven repository. Oracle provides the Maven Synchronization plug-in for this. So now we need install the plugin to local maven repository by using below MVN cmd.

mvn install:install-file -DpomFile=oracle-maven-sync.12.1.3.pom -Dfile=oracle-maven-sync.12.1.3.jar

NOTE:
"oracle-maven-sync-12.1.3.jar" and "oracle-maven-sync-12.1.3.pom" are available in below location.
These two files comes with JDev12c installation at below location.
%ORACLE_HOME%/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3/



Step4: Next step is to execute the plugin in order to import the Oracle Maven artifacts, including the Parent POM necessary for deploying our SOA composite.

mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=D:/Fusion12C/Oracle/Middleware/Oracle_Home



NOTE: After completing execution of above command now we can see Parent POM in below location.
C:\Users\Fusion\.m2\repository\com\oracle\soa\orabpel\12.1.3-0-0
Parent POM file Name : orabpel-12.1.3-0-0.pom
we can use this file as parent for all pom.xml files which created along with SOA 12c projects.
In this file we can store global parameters like deployment server, user and password. Of-course we can discuss this in my next post.



Thats it, now maven is ready in your machine to execute MVN cmd's.

Maven Life cycle:
--> mvn validate
Ensure that the project is correct and all necessary information is available.
--> mvn compile
Compile the source of the project
--> mvn test
Test the compiled source code using a suitable unit testing framework; tests should not require the code to be packaged or deployed.
--> mvn package
Take the compiled code and package it in its distributable format, such as a JAR, WAR, EAR, SAR, or GAR files.
--> mvn integration-test
Process and deploy the package, if necessary, into an environment where integration tests can be run.
--> mvn verify
Run checks to verify whether the package is valid and meets quality criteria.
--> mvn install
Install the package into the local repository for use as a dependency in other projects locally.
--> mvn deploy
For the final release, copy the final package to a remote repository for sharing with other developers and projects.

By using mvn we can execute maven archetypes like below.
--> mvn archetype:generate
To create a SOA application and SOA Project with required SOA package structures and ID's.
--> mvn pre-integration-test
To deploy all soa projects in SOA application.

Few more maven goals and archetypes are available, we can discuss them in my next post.







Sunday, 14 December 2014

Rightnow adapter setup in oracle soa 12c Jdeveloper

Rightnow adapter setup in oracle soa 12c Jdeveloper
 S
As we know about new release of SOA 12c suite, i want to introduce few concepts of integration between SOA 12c and oracle rightnow system.
One of the important feature in soa 12c suite is cloud adapters. Oracle is providing salI x z s bneforce adapter and rightnow adapter as part of cloud integration.
When we install Jdeveloper12.1.3 version by default we can see salesforce adapter but we dont have rightnow adapter along with default jdeveloper setup.
To get rightnow adapter in Jdeveloper we have to install a path with Opath utility.

In this post i want to provide steps to setup rightnow adapter in jdevloper.

Step1:  download RightNowAdapter_121300_Patch.zip from Oracle Technology Network.

url :  http://www.oracle.com/technetwork/middleware/adapters/downloads/index.html

Step2:  unzip RightNowAdapter_121300_Patch.zip.
After unzip we can see below folders and files.


Setp3: In "Prereq_patches" folder we have 5 more zip files. These files are prerequisite patch files for p19479397_121300_Generic.zip


Step4: unzip below zip files in "PATCH_TOP" folder. (PATCH_TOP folder is a user defined folder)

Prerequisite patch files :
a. p18706071_121300_Generic.zip (after unzip folder name is 18706071)
b. p18858892_121300_Generic.zip (after unzip folder name is 18858892)
c. p19248641_121300_Generic.zip (after unzip folder name is 19248641)
d. p19423468_121300_Generic.zip (after unzip folder name is 19423468)
e. p19769394_121300_Generic.zip (after unzip folder name is 19769394)

Actual patch file :

a. p19479397_121300_Generic.zip (after unzip folder name is 19479397)



Step5: open cmd prompt with run as administrator.

Step6: we can find Opatch util in "<ORACLE_HOME>\OPatch" location.
ex: C:\JDeveloper12.1.1.3\Oracle\Middleware\Oracle_Home\OPatch

Step7: In cmd prompt enter into OPatch folder and run below cmd.
opatch version
this cmd will show us the proper version of OPatch in our machine.

Step8: Validate the OUI inventory with the following commands:
        opatch lsinventory -jre C:\Progra~1\Java\jdk1.7.0_60\jre

Step9: In cmd prompt enter into patch folder location.
ex : cd C:\PATCH_TOP\Prereq_patches\18706071

Step10: now run below cmd in cmd prompt.
<path to reach opatch file>\opatch apply

Step11: repeat step9 and 10 for all patch files as provided in above order.

Step12: restart Jdeveloper with clean parameter.
Jdeveloper.exe -clean

Step13: now we can see rightnow adapter in Jdeveloper.

In my next post i will show you how to use rightnow adapter to integrate SOA12c with rightnow system.


Saturday, 25 October 2014

File Adapter MOVE operation in Oracle SOA 11g

File Adapter MOVE operation in Oracle SOA Suite 11g

The Oracle File and FTP Adapters let you copy or move a file from one location to another, or delete a file from the target directory. Additionally, the Oracle FTP Adapter lets you move or copy files from a local file system to a remote file system and from a remote file system to a local file system. This feature is implemented as a interaction specification for outbound services. So, this feature can be accessed either by using a BPEL invoke activity or a Mediator routing rule.

Step 1 :
Drag drop file adapter in reference pane of composite.xml

Setp 2:
In file adapter wizard perform below steps.

In wizard step4 we have to select Synchronous Read File
NOTE : You have selected Synchronous Read File as the operation because the WSDL file that is generated because this operation is similar to the one required for the file I/O operation.

provide your own name as per naming convention which you follow.
In my case i provided "FileMove" as move operation name.

Enter a dummy physical path for the directory for incoming files, and then click Next. The File name page is displayed.
Note: The dummy directory is not used. You must manually change the directory in a later step.

Enter a dummy file name, and then click Next. The Messages page is displayed.

Note: The dummy file name you enter is not used. You must manually change the file name in a later step.
Select Native format translation is not required (Schema is opaque), and then click Next. The Finish page is displayed.
Note: we are planning to perform move operation so we no need to process the payload. For this reason no need to create an XSD.



Step 3:
now open file adapter .jca file which looks as below.

=====================================================================
<adapter-config name="FileAdptMoveTest" adapter="File Adapter" wsdlLocation="FileAdptMoveTest.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
 
  <connection-factory location="eis/FileAdapter"/>
  <endpoint-interaction portType="FileMove_ptt" operation="FileMove">
    <interaction-spec className="oracle.tip.adapter.file.outbound.FileReadInteractionSpec">
      <property name="DeleteFile" value="true"/>
      <property name="PhysicalDirectory" value="C:/Dummy path"/>
      <property name="FileName" value="dummyFileName.txt"/>
    </interaction-spec>
  </endpoint-interaction>
</adapter-config> =====================================================================

Step 4:

Now replace <endpoint-interaction>-----</endpoint-interaction> with below code.
<interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">
      <property name="SourcePhysicalDirectory" value="foo1"/>
      <property name="SourceFileName" value="bar1"/>
      <property name="TargetPhysicalDirectory" value="foo2"/>
      <property name="TargetFileName" value="bar2"/>
      <property name="Type" value="MOVE"/>
</interaction-spec>

After the change in .jca file, it should looks as below.
=================================================================
<adapter-config name="FileAdptMoveTest" adapter="File Adapter"
                wsdlLocation="FileAdptMoveTest.wsdl"
                xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/FileAdapter"/>
    <endpoint-interaction portType="FileMove_ptt" operation="FileMove">
        <interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">
            <property name="SourcePhysicalDirectory" value="C:\Users\Fusion\Desktop\source"/>
            <property name="SourceFileName" value="student.txt"/>
            <property name="TargetPhysicalDirectory" value="C:\Users\Fusion\Desktop\target"/>
            <property name="TargetFileName" value="studentNew.txt"/>
            <property name="Type" value="MOVE"/>
        </interaction-spec>
    </endpoint-interaction>
</adapter-config>
=================================================================
Note : Note: You have modified the className attribute, and added SourcePhysicalDirectory, SourceFileName,TargetPhysicalDirectory, TargetFileName and Type.  The Type attributes decides the type of operation. Apart from MOVE, the other acceptable values for the Type attribute are COPY and DELETE.

Note :  SourceFileName and TargetFileName no need to be same. we can provide different file names.

Note : Currently, the values for the source and target details are dummy. You must populate them at run-time with .The source and target details are hardcoded in the preceding example. You can also provide these details as run-time parameters.

       (a) create 4 string variables in BPEL.
                   <variable name="sourceDirectory" type="xsd:string"/>
                   <variable name="sourceFileName" type="xsd:string"/>
                   <variable name="targetDirectory" type="xsd:string"/>
                   <variable name="targetFileName" type="xsd:string"/>
            Note: Make sure about namespace in .bpel file. Just cross check below namespace is available  in .bpel or not.
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      (b) get the source and target folder path , source and target file name from any source. Like recieve activity input variable or from a DVM or from a table. Some how get the required date and by using Assign activity copy the data from proper source to newly created variables.


Step 5:
Now open .bpel source view.
Add custom properties in invoke activity.

Existing code:
 <invoke name="Invoke1" inputVariable="Invoke1_FileMove_InputVariable"
                outputVariable="Invoke1_FileMove_OutputVariable"
                partnerLink="FileAdptMoveTest" portType="ns1:FileMove_ptt"
                operation="FileMove" bpelx:invokeAsDetail="no"/>

Modified Code:
 <invoke name="Invoke1" inputVariable="Invoke1_FileMove_InputVariable"
                outputVariable="Invoke1_FileMove_OutputVariable"
                partnerLink="FileAdptMoveTest" portType="ns1:FileMove_ptt"
                operation="FileMove" bpelx:invokeAsDetail="no">
<bpelx:inputProperty name="jca.file.SourceDirectory" variable="sourceDirectory"/>
<bpelx:inputProperty name="jca.file.SourceFileName" variable="sourceFileName"/>
<bpelx:inputProperty name="jca.file.TargetDirectory" variable="targetDirectory"/>
<bpelx:inputProperty name="jca.file.TargetFileName" variable="targetFileName"/>
</invoke>

sourceDirectory, sourceFileName, targetDirectory and targetFileName are string variables which we created in Step4.

NOTE : above properties syntax is related to bpel 1.1 version.




Friday, 24 October 2014

Part 1 : Oracle service cloud(Rightnow) & Oracle SOA integration

 Oracle SOA suite 11g integration with Oracle service cloud (Rightnow CX)
Part-1


Generate Key Store :

Step 1 :
open cmd prompt in admin mode (right click and run as administrator.)



Step 2 :
in my machine "keytool" is available in
"C:\Program Files\Java\jdk1.7.0_60\bin"

Step 3:
In CMD prompt enter into above path as shown in below image.

Step 4 (optional if you want to use default key store : DemoTrust.jks):
generate new keystore with below cmd.
keytool -genkeypair -keyalg RSA -alias orakey -keypass welcome1 -keystore <wl_home>\server\lib\SOAKeystore.jks -storepass welcome1 -validity 3600

Answer the questions as per your environment.
What is your first and last name?
  [Unknown]:  kumar korada
What is the name of your organizational unit?
  [Unknown]:  it
What is the name of your organization?
  [Unknown]:  it
What is the name of your City or Locality?
  [Unknown]:  abcd
What is the name of your State or Province?
  [Unknown]:  ab
What is the two-letter country code for this unit?
  [Unknown]:  in
Is CN=kumar korada, OU=it, O=it, L=abcd, ST=ab, C=in correct?
  [no]:  yes
NOTE: 
1) Observe "SOAKeystore.jk" created in "<wl_home>\server\lib\" folder.
2) "-keypass welcome1" will be used as keystore password.
3) .jks file name and password are user defined.
4) when ever we want to import any certificate into .jks file we should supply .jks file password. So it is mandatory to remember password. (not down some where :) )

NOTE:
As i mentioned earlier creation of keystore (.jks file)  is optional. We can use default .jks file which comes with WL server installation.

Default jks file name : DemoTrust.jks
Default jks password : DemoTrustKeyStorePassPharse

NOTE: DemoTrust.jks and DemoTrustKeyStorePassPharse are case sensitive.

Step 5 :
Get Oracle Service Cloud (RNCX) certificate with the help of RNCX wsdl.

WSDL syntax :
https://<host_name>/cgi-bin/<interface>.cfg/services/soap?wsdl

start internet explorer as admin


paste the wsdl in address bar. Now we can see gold colored lock icon.

 
 Click on lock icon and click View Certificate.
 
In the popup --> select  Details tab --> Public Key --> copy to file (save the certificate in a file)
 
 
 
 

Step 6 :
import rightnow certificate into keystore.

copy .cer file into <WL_HOME>/server/lib

Run below script in cmd prompt, to import Rightnow public key certificate into weblogic key store (.jks file)

keytool -importcert -alias rightnowcx -file <WL_HOME>\server\lib\rightnowcx.cer -keystore <WL_HOME>\server\lib\SOAKeystore.jks -storepass welcome1

cretificate imported into key store.

Step 7 :
Log in into "EM"
http://<host name>:<weblogic port>/em

expand Weblogic Domain --> right click on domain name --> Security --> Security Provider Configuration



click on Configure button.




password : provide keystore password (as per above script password is "welcome1").
key Alias & Crypt Alias : rightnow (as per above script ).