Tuesday, December 6, 2011

Oracle SOA Suite – Scheduling the composites using Quartz scheduler.

Oracle SOA Suite – Scheduling the composites using Quartz scheduler.

This blog will explain the approach to schedule the Oracle SOA Suite composites using the Quartz scheduler.

Approach to schedule the Oracle SOA Suite 11g composites 

Create the ADF binding to the composite.xml

Open the composite xml


Copy the service section and give a unique name e.g. bpelhelloworld_client_adf and also make sure the ServiceName specified is correct.


Copy the client partnerlink wire and edit the name of the copied wire as adf service name specified in the previous step.






Thursday, December 1, 2011

Oracle SOA Suite - Using the EJB Adapter to invoke the EJB's deployed in weblogic server

Oracle SOA Suite - Using the EJB Adapter to invoke the EJB's deployed in weblogic server:

We can use the EJB Adapter to expose the EJB remote interface as a service or to invoke the EJB as a reference.

This blog will explain how to use the EJB Adapter to invoke the EJB deployed in the weblogic server as a reference.

I have created a sample EJB (EmployeeDetailsSessionBean), which will be invoked from Composite, to return the employee details.

Refer the sample attached.

Steps:


  • Create a jar file e.g. RemoteInterface.jar including EJB Remote class and the Bean classes.

  • Create a SOA Composite with BPEL and add the EJB Service to the reference section.



Wednesday, November 30, 2011

Resetting Weblogic Server Admin Password

Resetting Weblogic Server Admin Password:

Steps to reset the admin password of weblogic server.

  • cd <DOMAIN_HOME>/security
  •  Rename DefaultAuthenticatorInit.ldift file to DefaultAuthenticatorInit.ldift_BKP
  • Set the Environment - <DOMAIN_HOME>/bin/setDomainEnv.cmd
  • java -cp <WLS_HOME>;/server/lib/weblogic.jar:$CLASSPATH weblogic.security.utils.AdminAccount NewAdminUser NewAdminPassword . (Note the . at the end of the command)
  Make sure you are running the above command is executed from    DOMAIN_HOME>/security,   if you are executing the command from other location copy the   DefaultAuthenticatorInit.ldift file created in the current location to <DOMAIN_HOME>/security
e.g java -cp C:\Oracle\MiddlewareSOA\wlserver_12.1\server\lib\weblogic.jar;%CLASSPATH% weblogic.security.utils.AdminAccount albin albin123  
  • Move data directory under $DOMAIN_HOME/servers/<serverName>/datato another directory like data.bak
  •  Edit user name and password in the following file - <DOMAIN_HOME>/servers/<Server Name>/security/boot.properties
  • Restart the admin server


Adding main class and jar files to Class-Path in manifest through ANT script

Adding main class and jar files to Class-Path in manifest through ANT script

The below ANT script will help us to add main class and jar files to Class-Path in manifest of the JAR file.

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="jar with libs" default="compile and build" basedir=".">

<target name="compile and build">
<delete dir="bin" />
<mkdir dir="bin"/>

<!-- copy the JARs that should be added to MANIFEST class-path to "bin" directory -->
<copy todir="bin">
<fileset dir="." includes="**/lib/*.jar" />
</copy>

<!-- creates your jar with the contents inside "bin" (now with your .class and .jar dependencies) -->
<jar destfile="SampleJar.jar" basedir="bin" duplicate="preserve">
<manifest>
<!-- Who is building this jar? -->
<attribute name="Built-By" value="Albin I" />
<!-- Information about the program itself -->
<attribute name="Implementation-Vendor" value="Company" />
<attribute name="Implementation-Title" value="Albin" />
<attribute name="Implementation-Version" value="1.0.0beta1" />
<attribute name="Class-Path" value="lib/bpm-services.jar lib/ldapjclnt11.jar lib/ojdbc14.jar lib/xmlparserv2.jar"/>

<!-- this tells which class should run when executing your jar -->
<attribute name="Main-class" value="com.import.ImportUtility" />
</manifest>
</jar>
</target>

</project>


JAVA utility class to encrypt/decrypt data using password based encryption(PBEWithMD5AndDES)

JAVA utility class to encrypt/decrypt data using password based encryption(PBEWithMD5AndDES)

The below code snippet will help us to encrypt/decrypt data using password based encryption(PBEWithMD5AndDES).

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEParameterSpec;


public class RdsCryptoLibrary {

private static final String PBE_KEY = "gZWKbHnijPAxrH+Sxw4fqp0FoVj6Ia2zA==qlPsn33wsz"
+ "ExumaDburVAw==PiU+p0wzGH2IbpQrpR6C7g==ld1"
+ "XwIUXYbSIBlPjTUYotg==CYm5rNsRA5KrGdPTvsrWuQ==";

private static final String PBE_ALGORITHM = "PBEWithMD5AndDES";

private static final String PBE_PROVIDER = "PBEWithMD5AndDES/CBC/PKCS5Padding";

private Cipher encryptCipher;

private Cipher decryptCipher;

private sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();

private sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();

public RdsCryptoLibrary( ) throws SecurityException {
//java.security.Security.addProvider(new com.sun.crypto.provider.SunJCE());
java.security.Security.addProvider(new com.ibm.crypto.provider.IBMJCE());
char[] pass = PBE_KEY.toCharArray();
byte[] salt = { (byte) 0xa3 , (byte) 0x21 , (byte) 0x24 , (byte) 0x2c ,
(byte) 0xf2 , (byte) 0xd2 , (byte) 0x3e , (byte) 0x19 };
int iterations = 3;
init(pass, salt, iterations);
}

public void init(char[] pass, byte[] salt, int iterations)
throws SecurityException {
try {
PBEParameterSpec ps = new javax.crypto.spec.PBEParameterSpec(salt,
20);

SecretKeyFactory kf = SecretKeyFactory.getInstance(PBE_ALGORITHM);
SecretKey k = kf.generateSecret(new javax.crypto.spec.PBEKeySpec(
pass));

encryptCipher = Cipher.getInstance(PBE_PROVIDER);
encryptCipher.init(Cipher.ENCRYPT_MODE, k, ps);

decryptCipher = Cipher.getInstance(PBE_PROVIDER);
decryptCipher.init(Cipher.DECRYPT_MODE, k, ps);
}
catch (Exception e) {
throw new SecurityException("Could not initialize CryptoLibrary: "
+ e.getMessage());
}
}

public synchronized String encrypt(String str) throws SecurityException {
try {
byte[] utf8 = str.getBytes("UTF8");
byte[] enc = encryptCipher.doFinal(utf8);
return encoder.encode(enc);
}
catch (Exception e) {
throw new SecurityException("Could not encrypt: " + e.getMessage());
}
}

public synchronized String decrypt(String str) throws SecurityException {
try {
byte[] dec = decoder.decodeBuffer(str);
byte[] utf8 = decryptCipher.doFinal(dec);
return new String(utf8, "UTF8");
}
catch (Exception e) {
throw new SecurityException("Could not decrypt: " + e.getMessage());
}
}
}