Sunday, December 31, 2017

How to integrate with Salesforce.com through Salesforce Adapter in Oracle SOA Suite 12c

How to integrate with Salesforce.com through Salesforce Adapter in Oracle SOA Suite 12c

Oracle SOA Suite Salesforce adapter helps to integrate with Salesfore to perform different operation on objects like CURD, QUERY etc.
This post will explain the approach to configure Salesfore Adapter to perform different operations.

Installing Salesforce.com  SSL certificates to Weblogic server:


Download the certificates(I am using the test salesforce instance): 


Open login.salesforce.com in browser(here I am using chrome browser)
Click on certificate icon and valid

export_salesfoce_login_certificate


Click on Details and Copy to File

export_salesfoce_login_certificate


Click on Next



Saturday, December 30, 2017

JCA Binding execute of Reference operation 'search' failed due to: LDAP_ERROR_IX_INVALID_IN_REC

JCA Binding execute of Reference operation 'search' failed due to: LDAP_ERROR_IX_INVALID_IN_REC

I was getting the below exception while integrating with Ldap Adapter for search operation in Oracle SOA Suite 12c

A fault occurred while invoking the webservice operation. The fault is : <env:Fault xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>env:Server</faultcode>
<faultstring>Exception occurred when binding was invoked.
Exception occurred during invocation of JCA binding: "JCA Binding execute of Reference operation 'search' failed due to: LDAP_ERROR_IX_INVALID_IN_REC.
Ldap Adapter has encountered an invalid operation request payload while executing an outbound interaction.
Operation request payload should be a valid instance of the ldap adapter request schema.
Please ensure that the request payload is a valid instance of the request operation schema.
".
The invoked JCA adapter raised a resource exception.
Please examine the above error message carefully to determine a resolution.
</faultstring>
<faultactor/>
<detail>
<exception>Element not completed: 'searchRequest'</exception>
</detail>
</env:Fault>
oracle.sysman.emInternalSDK.webservices.util.SoapTestException: Client received SOAP Fault from server : Exception occurred when binding was invoked.
Exception occurred during invocation of JCA binding: "JCA Binding execute of Reference operation 'search' failed due to: LDAP_ERROR_IX_INVALID_IN_REC.
Ldap Adapter has encountered an invalid operation request payload while executing an outbound interaction.
Operation request payload should be a valid instance of the ldap adapter request schema.
Please ensure that the request payload is a valid instance of the request operation schema.
".
The invoked JCA adapter raised a resource exception.
Please examine the above error message carefully to determine a resolution.

This exception occurred due to the missing input mapping for baseDN and searchFilter in the Ldap input variable(Invoke activity), make sure the variable is mapped with required input e.g. below





Configure Ldap Adapter connection factories through WLST script - Oracle SOA Suite 12c

Creating Ldap Adapter connection factories through WLST script - Oracle SOA Suite 12c

The below WLST script will help us to create the Ldap adapter connection factories in Oracle SOA Suite 12c

Change the Ldap/SOA server details accordingly in the script.

Before executing the script make sure the LdapAdapter is targeted to the SOA servers.


traget_ldap_adapter_soa_server

CreateLdapAdapterFactory.py

targetServerName='AdminServer' 

soaHome='C:\Albin\SW\SOA-12c\Oracle\Middleware\Oracle_Home\soa'

appPathLdap=soaHome+'\soa\connectors\LdapAdapter.rar'
appNameLdap='LdapAdapter'
moduleOverrideNameLdap=appNameLdap+'.rar'
LdapJNDIName = 'eis/Ldap/BlogSample'

bindDN='uid=admin,ou=system'
hostName='localhost'
password='secret'
port='10389'
trustAll='false'
trustStorePassword='false'


moduleDescriptorName='META-INF/weblogic-ra.xml'
planPathLdap='C:\Albin\workarea\Plan_Ldap.xml'

def createLdapConnectionFactory():  

edit()
startEdit()
startApplication(appNameLdap)
myPlanLdap=loadApplication(appPathLdap, planPathLdap)
makeDeploymentPlanVariable(myPlanLdap,'ConnectionInstance_eis/Ldap_JNDIName_13102979357209', LdapJNDIName , '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+LdapJNDIName+'"]/jndi-name',moduleOverrideNameLdap)
makeDeploymentPlanVariable(myPlanLdap, 'ConfigProperty_eis/Ldap_JNDIName_Host_Name_13102979357210', bindDN,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+LdapJNDIName+'"]/connection-properties/properties/property/[name="bindDN"]/value',moduleOverrideNameLdap)
makeDeploymentPlanVariable(myPlanLdap, 'ConfigProperty_eis/Ldap_JNDIName_Port_13102979357211', hostName,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+LdapJNDIName+'"]/connection-properties/properties/property/[name="hostName"]/value',moduleOverrideNameLdap)
makeDeploymentPlanVariable(myPlanLdap, 'ConfigProperty_eis/Ldap_JNDIName_Port_13102979357212', password,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+LdapJNDIName+'"]/connection-properties/properties/property/[name="password"]/value',moduleOverrideNameLdap)
makeDeploymentPlanVariable(myPlanLdap, 'ConfigProperty_eis/Ldap_JNDIName_Port_13102979357213', port,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+LdapJNDIName+'"]/connection-properties/properties/property/[name="port"]/value',moduleOverrideNameLdap)
makeDeploymentPlanVariable(myPlanLdap, 'ConfigProperty_eis/Ldap_JNDIName_Port_13102979357214', trustAll,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+LdapJNDIName+'"]/connection-properties/properties/property/[name="trustAll"]/value',moduleOverrideNameLdap)
makeDeploymentPlanVariable(myPlanLdap, 'ConfigProperty_eis/Ldap_JNDIName_Port_13102979357215', trustStorePassword,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+LdapJNDIName+'"]/connection-properties/properties/property/[name="trustStorePassword"]/value',moduleOverrideNameLdap)


myPlanLdap.save();
save();
cd('/AppDeployments/LdapAdapter/Targets');
updateApplication(appNameLdap, planPathLdap);
startApplication(appNameLdap);
activate(block='true');

    
def makeDeploymentPlanVariable(wlstPlan, name, value, xpath,overrideName, origin='planbased'):
    wlstPlan.destroyVariable(name)
    wlstPlan.destroyVariableAssignment(name, overrideName, moduleDescriptorName)
    variableAssignment = wlstPlan.createVariableAssignment(name, overrideName, moduleDescriptorName)
    variableAssignment.setXpath(xpath)
    variableAssignment.setOrigin(origin)
    wlstPlan.createVariable(name, value)
    print 'moduleDescriptorName=',moduleDescriptorName


def main():
       #SOA Server Details
       adminURL='t3://localhost:7201'
       adminUserName='weblogic'
       adminPassword='Albin123!'
       connect(adminUserName, adminPassword, adminURL)
       createLdapConnectionFactory()
       disconnect()
main()



Creating Coherence Adapter connection factories through WLST script - Oracle SOA Suite 12c

Creating Coherence Adapter connection factories through WLST script - Oracle SOA Suite 12c

The below WLST script will help us to create the Coherence adapter connection factories in Oracle SOA Suite 12c

Change the Coherence/SOA server details accordingly in the script.

Before executing the script make sure the CoherenceAdapter is targeted to the SOA servers.


traget_coherence_adapter_soa_server

CreateCoherenceAdapterFactory.py

targetServerName='AdminServer' 

soaHome='C:\Albin\SW\SOA-12c\Oracle\Middleware\Oracle_Home\soa'

appPathCoherence=soaHome+'\soa\connectors\CoherenceAdapter.rar'
appNameCoherence='CoherenceAdapter'
moduleOverrideNameCoherence=appNameCoherence+'.rar'
CoherenceJNDIName = 'eis/Coherence/BlogSample'

CacheConfigLocation='C:\Albin\workarea\coherence-adapter-config.xml'
ClassLoaderMode='CUSTOM'
WLSExtendProxy='false'
PojoJarFile='C:\Albin\workarea\cache-pojos.jar' # Include this if Cache Type is POJO - Jar file contains the POJO classes
ServiceName='DistributedCache' #ServiceName configured in Cache Config File.

moduleDescriptorName='META-INF/weblogic-ra.xml'
planPathCoherence='C:\Albin\workarea\Plan_Coherence.xml'

def createCoherenceConnectionFactory():  

edit()
startEdit()
startApplication(appNameCoherence)
myPlanCoherence=loadApplication(appPathCoherence, planPathCoherence)
makeDeploymentPlanVariable(myPlanCoherence,'ConnectionInstance_eis/Coherence_JNDIName_13102979357209', CoherenceJNDIName , '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+CoherenceJNDIName+'"]/jndi-name',moduleOverrideNameCoherence)
makeDeploymentPlanVariable(myPlanCoherence, 'ConfigProperty_eis/Coherence_JNDIName_Host_Name_13102979357210', CacheConfigLocation,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+CoherenceJNDIName+'"]/connection-properties/properties/property/[name="CacheConfigLocation"]/value',moduleOverrideNameCoherence)
makeDeploymentPlanVariable(myPlanCoherence, 'ConfigProperty_eis/Coherence_JNDIName_Port_13102979357211', ClassLoaderMode,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+CoherenceJNDIName+'"]/connection-properties/properties/property/[name="ClassLoaderMode"]/value',moduleOverrideNameCoherence)
makeDeploymentPlanVariable(myPlanCoherence, 'ConfigProperty_eis/Coherence_JNDIName_Port_13102979357212', WLSExtendProxy,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+CoherenceJNDIName+'"]/connection-properties/properties/property/[name="WLSExtendProxy"]/value',moduleOverrideNameCoherence)
makeDeploymentPlanVariable(myPlanCoherence, 'ConfigProperty_eis/Coherence_JNDIName_Port_13102979357213', PojoJarFile,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+CoherenceJNDIName+'"]/connection-properties/properties/property/[name="PojoJarFile"]/value',moduleOverrideNameCoherence)
makeDeploymentPlanVariable(myPlanCoherence, 'ConfigProperty_eis/Coherence_JNDIName_Port_13102979357214', ServiceName,'/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="javax.resource.cci.ConnectionFactory"]/connection-instance/[jndi-name="'+CoherenceJNDIName+'"]/connection-properties/properties/property/[name="ServiceName"]/value',moduleOverrideNameCoherence)

myPlanCoherence.save();
save();
cd('/AppDeployments/CoherenceAdapter/Targets');
updateApplication(appNameCoherence, planPathCoherence);
startApplication(appNameCoherence);
activate(block='true');

    
def makeDeploymentPlanVariable(wlstPlan, name, value, xpath,overrideName, origin='planbased'):
    wlstPlan.destroyVariable(name)
    wlstPlan.destroyVariableAssignment(name, overrideName, moduleDescriptorName)
    variableAssignment = wlstPlan.createVariableAssignment(name, overrideName, moduleDescriptorName)
    variableAssignment.setXpath(xpath)
    variableAssignment.setOrigin(origin)
    wlstPlan.createVariable(name, value)
    print 'moduleDescriptorName=',moduleDescriptorName


def main():
       #SOA Server Details
       adminURL='t3://localhost:7201'
       adminUserName='weblogic'
       adminPassword='Albin123!'
       connect(adminUserName, adminPassword, adminURL)
       createCoherenceConnectionFactory()
       disconnect()

main()


Friday, December 29, 2017

Create Java DB connection in JDeveloper 12.2.1.3.0

Click on Windows - Database - Databases

Jdeveloper_Java_DB_connection
Create new IDE connection

Jdeveloper_Java_DB_connection

Select the Connection Type as Java DB/Apache Derby
Username -  soainftra
Driver Class - org.apache.derby.jdbc.ClientDriver
HostName - localhost (or enter the IP address)
JDBC Port -  1527
Database Name - soinfra
Password - Leave blank

Click on Test Connection - the result will display as success

The tables can  be accessed now - Open the SQL Worksheet and execute the required SQL queries

e.g - select * from soainfra.cube_instance

Jdeveloper_Java_DB_connection