Saturday, August 20, 2016

hisham.info Is The New Address for My Blog

I decided to change my blog address from hishamgalal.blogspot.com to hisham.info and use Wordpress instead of Blogger, as Wordpress became much better and has more features.

Wednesday, August 17, 2016

ICS Agent Connection Error mcsinternal.us2.oraclecloud.com:7777

If you are facing issues with ICS On-Premise Agent, sometimes it is because of the connectivity to messaging cloud service. If you checked the logs and found connection exception like below:

Caused By: java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'mcsinternal.us2.oraclecloud.com', port: ‘7777'

Don't worry we have a solution for this, open this file /agent/config/CpiAgent.properties and change the following:

omcsUri= omcsUri=http://mcsinternal.us2.oraclecloud.com:7777/ABCD_Messaging-XYZ000

With this value

omcsUri= https://messaging.us2.oraclecloud.com/ABCD_Messaging-XYZ000


Salesforce 2 Salesforce Integration using Oracle Integration Cloud Service

In this integration tutorial, I am assuming integrating two Salesforce Systems in order to synchronize Accounts, and this was based on a real use case that I worked on.

Login into the SOURCE SFDC instance using its credentials.  


Open Setup  


Using right side search box, open API  


Under WSDL and Client Certificates, click “Generate Enterprise WSDL”, then Generate  


Save the generated WSDL file (you can name it as you want(, and call it enterprise1.wsdl  


Return back to “WSDL and Client Certificates” page, choose Generate Client Certificate  


A certiticate is downloaded and called sfdc-client.cert, next we need to convert it to .CER format to be able to import it to ICS. Open certmgr.msc from Windows Run.  


Import sfdc-client.cert using certmgr utility.  


If the certificate is imported under personal certificates directory, you find a certificate called proxy.salesforce.com.   


Open the imported certificate, and under details click “Copy to File”  


Choose the default, and export the certificate into .CER  


No need to export the issuer or any other certificate on the tree.

Now login to the DESTINATION SFDC instance using its credentials.  


Repeat Steps from 2 to 12. You should have the DESTINATION SFDC enterprise WSDL and client certificate.

Now we create outbound message in SOURCE SFDC Salesforce, so that whenever there is an account updated (you build your own criteria), then a new outbound message got created. Under setup, search for “Outbound Messages”.  


Click “New Outbound Message” , and choose “Account” object, then click next

Add the following info:
Name= XYZ_Account
Endpoint URL=http://dummy (to be changed latter)
Choose your Account Fields to be sent, and then save.  


Then under Setup, search for “Workflow Rules”.  


Click create “New Rule”  


Choose “Account” object, then click Next.

Add the following Info:
Rule Name=RULE1
Evaluate the rule when a record is = “created, and any time it's edited to subsequently meet criteria”
Field= Any criteria field
Operator= equals
Value= License Issued
Then click “Save & Next”

Under “Add Workflow Action”, choose “Select Existing Action”, then choose “Outbound Message: XYZ_Account”.
Then click Save. Then  


Open the created rule and “Activate” it.  


Now return to “Outbound Message” again, and make sure “Send Session ID” is checked. Then click on “Click for WSDL” to download the outbound message WSDL.  


Save the WSDL file to be used with ICS later on and call it accounts.wsdl (you can call it as you want)  


Now login to ICS, by adding identity domain and access credentials:
Identity Domain=
Username=
Password=  


Choose “Connections”, then choose “Create New Connection”  


Choose “Salesforce” Adapter  


Under “New Connection – Information” add the following:
Connection Name=SOURCE SFDC Conn
Identifier= SOURCE_SFDC_CONN

And under Connection Properties:
Enterprise WSDL Location= source-enterprise-wsdl.wsdl

And under Security:
Username= 
Password =….  



Test and Save the connection, and make sure it shows 100% completed.  



Repeat steps 27 to 30 to create a connection for DESTINATION SFDC instance:
Connection Name=Destination SDFC Conn
Identifier= DESTINATION_SFDC_CONN


And under Connection Properties:
Enterprise WSDL Location= desitnation-enterprise-wsdl.wsdl

And under Security:
Username= 
Password =….  


Now you should have both of the connections configured.  


Now open Administration  


Upload Salesforce client certificates for SOURCE SFDC and DESTINATION SFDC that we have converted to .CER  


Now return to designer and choose “Integrations”  


Then click “Create New Integration” and choose “Map My Data”
 

Now for “New Integration – Information” add the following:
Integration Name= SFDC Accounts SYNC
Identifier= SFDC _ACCOUNTS_SYNC

Next we need to drag and drop connections to the corresponding endpoints.  




Drag and drop SOURCE_SFDC_Conn as a source connection on the left side. A wizard dialog will appear to configure Salesforce outbound messages connectivity.

Call this endpoint “PublishAccounts” (You can call it as you want)

Then Click Next.  


Then choose the Outbound Messaging WSDL, in our case we saved it as “accounts.wsdl”.

Then Click Next.  


In “Response” step, uncheck Send a response.

Then Click Next.   


Review Summary and Click Done.  


Now drag and drop DESITNATION_SFDC_Conn to the destination endpoint on the right side.

A wizard will appear to configure Salesforce inbound messages connectivity.

Call this endpoint “SyncAccounts” (You can call it as you want)

Then Click Next.  


In “Operations” step, select “Operation Type” equals “CRUD” and then select “create”.

Then under “Business Objects” select “Account”.

Then Click Next.  


In “Headers” step choose the default values.

Then Click Next.  


Review Summary and Click Done.  


Now we need to do mappings and transformation  



Click on Create Map, and apply the shown mapping. Then Save and return.

 


Now the last step is to do tracking configurations for integrations.

Click on tracking on the top, and choose tracking fields.

Then click Done.
 


Last thing Save and make sure that the integration is 100% complete. 

Then click Exit Integration.  

Now “Activate” the integration.



For PoC purposes choose “Enable tracing including payload into Activity Stream” in order to check payload later.  



Now we need to copy ICS integration endpoint by clicking on integration details.  


Then add to SOURCE SFDC Outbound Message “XYZ_ACCOUNT” that we created previously, the “Endpoint URL” for ICS that we copied in the previous step

The Endpoint URL must not include ?wsdl in the end.

Now you can test the integration by either creating new Account in SOURCE SFDC instance and make the criteria is met and outbound message has been sent correctly without issues (you can monitor outbound messages from within Salesforce).