Monday, January 1, 2018

How to receive Outbound Message notification from Salesfore through Salesforce Adapter in Oracle SOA Suite 12c

How to receive Outbound Message notification from Salesfore through Salesforce Adapter in Oracle SOA Suite 12c

Salesforce Outbound messaging allows you to specify that changes to fields within Salesforce can cause messages with field values to be sent to designated external servers.

Outbound messaging is part of the workflow rule functionality in Salesforce. Workflow rules watch for specific kinds of field changes and trigger automatic Salesforce actions, such as sending email alerts, creating task records, or sending an outbound message.

After you set up outbound messaging, when a triggering event occurs, a message is sent to the specified endpoint URL. The message contains the fields specified when you created the outbound message. Once the endpoint URL receives the message, it can take the information from the message and process it. To do that, you need to examine the outbound messaging WSDL.

The Salesforce Adapter in Oracle SOA Suite help to integrate with Salesforce cloud. This post will explain the steps to enable the Outbound messaging in Salesfore and receive the notifications in Oracle SOA Suite via Salesforce Adapter.

Define Outbound message in Salesforce:


Login to Salesforce
Click on Setup

salesforce_setup

Search for Outbound messages and click on Workflow & Approvals -  Outbound Messages

salesforce_outbound_messages

Click on Continue in the next screen
Click on New Outbound Message

salesforce_outbound_messages

Select the required Object and Click on Next




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()