Tuesday, October 11, 2011

Import Client Certificates in SOA 11g

This Article will teach you how to Import Client Certificates in SOA 11g 


Solution 1:


Steps:   
  • Download client certificate from Mozilla or IE,name it as gmail-smtp.cer   
  • Open command prompt and Import this Certificate into your JDK certs file using keytool
keytool -import  -file E:\gmailCert\gmail-smtp.cer -alias RootCA -keystore C:\Oracle\Middleware\jdk160_24\jre\lib\security\cacerts -storepass changeit

  • Create new keystore  and name it myykeystore.jks using blow command 
keytool -genkey -keystore C:\Oracle\Middleware\wlserver_10.3\server\lib\mykeystore.jks -storepass welcome1

  • Import your certificate into mykeystore.jks keystore.
keytool -import  -file E:\gmailCert\gmail-smtp.cer -alias RootCA -keystore C:\Oracle\Middleware\wlserver_10.3\server\lib\mykeystore.jks -storepass welcome1

  • Edit C:\Oracle\Middleware\user_projects\domains\base_domain\bin\setDomainEnv.cmd.search for -Djavax.net.ssl.trustStore text in the file and replace with
-Djavax.net.ssl.trustStore=${WL_HOME}/server/lib/mykeystore.jks   
-Djavax.net.ssl.trustStorePassword=welcome1

  •  Open Admin Console and modify the keystore for SOA server.Click on Change button and select the custom Identity and java standard trust  from dropdown.
Custom Identity Keystore:C:\Oracle\Middleware\wlserver_10.3\server\lib\mykeystore.jks
Custom Identity Keystore Type: jks
Custom Identity Keystore Passphrase: welcome1
Confirm Custom Identity Keystore Passphrase: welcome1

Restart SOA server and then test.


Solution 2



  •     Obtain security certificate from SFDC to connect to SFDC services (e.g. sfdc-client.cert).
  •    Import certificate obtained from SFDC into keystore
  •       /xgsoadv4a/oracle/fmw/java/bin/keytool -import -alias proxy.salesforce.com -keystore     SFDCKeyStore.jks -file /home/soaadmin/temp/sfdc-client.cert
  •   Remove the following entry from domain's setDomainEnv.sh (<domain_home>/bin/setDomainEnv.sh) -  
  •           -Djavax.net.ssl.trustStore=${WL_HOME}/server/lib/DemoTrust.jks .
  •  Login to the Fusion Middleware Control console (i.e. "http://WLserver:port/em") . Navigate to Farm_<domain>/SOA/soa-infra". Right-click on "soa-infra" on the left pane. Select "SOA Administration --> Common Properties", click the hyperlink at the bottom for "More SOA Infra Advanced Configuration Properties".
  •  Find the entry for KeystoreLocation - and provide the path to the keystore that contains CA Certificates. Click on Apply.



6.       Add credential entry to allow BPEL to open the keystore file. Navigate to "WebLogic Domain/<domain name>". From pulldown menu, select "Security->Credentials". Add a new map called "iClickSFDC" and add two new keys inside that map (default password is changeit):
Key Name
Type
User Name
Password
KeyPassword
password
KeyPassword
<password>
KeystorePassword
password
KeystorePassword
<password>




7.       Restart webLogic domain servers.



Tuesday, March 15, 2011

How do you configure transaction timeout for BPEL on SOA 11g?

As a general rule, you should keep the following relation between the timeout parameters:

syncMaxWaitTime < BPEL EJB's transaction timeout < Global Transaction Timeout
Note: This recommendation are ONLY applicable to Sync Processes. Additionally the default Timeout setting that comes with SOA 11g installation does not comply with this rule. You might need to adjust the setting according to your particular business needs.


1. Setting syncMaxWaitTime:

This property controls the maximum time the process result receiver will wait for a result before returning for Sync processes.

For SOA 11g R1 PS1 (11.1.1.4 and later):
* Login into EM
* Expand SOA and right click on "soa-infra" and select: SOA Administration -> BPEL Properties
* Click on "More BPEL Configuration Properties..." link
* Locate syncMaxWaitTime and change it.


2. Setting the transaction timeout for BPEL EJB's:

The timeout properties for the EJB's control the particular timeout setting for the SOA application, overriding the global setting specified by the JTA timeout (See step 3).

* Log into Oracle WebLogic Administration Console.

Stop SOA Managed Server
* Click Deployments.

* Expand soa-infra -> EJBs.
* Following EJBs need to be updated:
BPELActivityManagerBean
BPELDeliveryBean
BPELDispatcherBean
BPELEngineBean
BPELFinderBean
BPELInstanceManagerBean
BPELProcessManagerBean
BPELSensorValuesBean
BPELServerManagerBean
* You can check in the config tab for the timeout setting in the BPEL* EJBs.
* Click Save.
* Restart Oracle WebLogic Server.

3. Setting the global transaction timeout at Weblogic Domain Level:


This property controls the transaction timeout seconds for active transactions. If the transaction is still in the "active" state after this time, it is automatically rolled back.

   * Log into Oracle WebLogic Administration Console.
   * Click Services -> JTA.
   * Change the value of Timeout Seconds (the default is 30).
   * Click Save.
   * Restart Oracle WebLogic Server.



More information available at:



Note: For receive/invoke timeout introduced for Async Processes with PS3, refer:
http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10224/bp_events.htm#insertedID0

How to set delay between JMS/AQ Quque Messages in soa11g



After reading your issue, description I would like to suggest the below solution:


There is an activation agent which can be used to control the speed at which the adapter posts messages to BPEL 


in 11G the setting would be configured as a binding property in the composite.xml the corresponding (inbound) <service>, e.g. 


<service name="Inbound">
<interface.wsdl interface="http://xmlns.oracle.com/pcbpel/demo1#wsdl.interface(SampleInbound_PortType)"/>
<binding.jca config="Dequeue_jms.jca">
<property name="minimumDelayBetweenMessages">1000</property> ------ this is the property that is being implemented.
</binding.jca>
</service> 


This setting ensures that there at least will be 1000 milliseconds delay between the two consecutive messages being posted to the BPEL process.


Note: this setting pertains only to BPEL, and only to one adapter polling thread. If multiple adapter polling threads (e.g. multiple JMS dequeuer threads) have been configured, this setting will control the speed of each thread, not the combined speed.


By implementing the above mentioned solution, I would like to highlight one point though, you need to keep in mind that the delay will happen all the time regardless of heavy or light load. 

How to make your File Adapter pick only one file at a time from a location

In SOA 11g, you use File adapter to read files from the given location.
With this read operation it picks all the files at time.

You want to configure File Adapters that it should pick one file at time from the given location with given polling interval.

Solution :

You set the "SingleThreadModel" and "MaxRaiseSize" properties for your file adapter.
Edit the adapter's jca file and add the following properties:

property name="SingleThreadModel" value="true"
property name="MaxRaiseSize" value="1"

You can set these properties also through jdeveloper, by opening composite.xml, selecting the adapter and then changing the properties through the properties panel.

Tuesday, November 23, 2010

Working with Event Driven Network (EDN) in SOA 11g

A nice new addition to OFM11g is the Event Delivery Network (EDN). This makes it possible to publish and subscibe to business events in a SOA composite application. In this post I will show you how to create a business event. We will use a simple case, the placing of an order and acting on it. Also, I assume you have a basic knowledge on creating SOA composites in JDeveloper 11g.
Firstly, we have to create a new empty SOA project in JDeveloper 11g. Now we create an xsd schema with the purpose of defining the event payload.
01xml version="1.0" encoding="windows-1252" ?><xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"
02            xmlns="http://www.whitehorses.nl/schemas/order"
03            targetNamespace="http://www.whitehorses.nl/schemas/order"
04            elementFormDefault="qualified">
05  <xsd:element name="order">
06    <xsd:complexType>
07      <xsd:sequence>
08        <xsd:element name="product" type="xsd:string"/>
09        <xsd:element name="cost" type="xsd:string"/>
10      xsd:sequence>
11    xsd:complexType>
12  xsd:element>
13xsd:schema>
Now that we have created the payload it is necessary to create a new Event Definition. This results in a .edl file which describes all events in the current soa project. We create the definition by clicking the “lightning” icon in the design view of the composite.xml. When the “Event Definition Creation” dialog is displayed we create an event by clicking the “plus” icon. Here we select the “order” element by using the type chooser. For the name we choose “OrderPlacedEvent”. The dialog should now look as follows:
The Event Defintion Creation Dialog showing the single OrderPlacedEvent.
The Event Defintion Creation Dialog showing the single OrderPlacedEvent.
After clicking “Ok” you are taken to the events editor from which you can add / modify or delete events. For now we can close it.
Now we create a “one-way” mediator and expose it as a service. Lets call the mediator “PlaceOrderMediator”. For input we use the “order” element that can be found in order.xsd. After double-clicking the mediator we add a new static routing rule by clicking the “plus” icon in the routing rules section. As target type we choose “event”. The “Event Chooser” dialog appears. As you can see it will load the events from the OrderEvents.edl we have created. Make sure the OrderPlacedEvent is selected and click “Ok”. There will be no need to create a transformation map because the input of the mediator and the event are the same elements, namely “order”.
We now have a mediator which will publish the “OrderPlacedEvent”.
The mediator which publishes the event
The mediator which publishes the event
To subscribe to this event we will create a new mediator which in turn will write the order to a log file using a File adapter. I will only show how to subscribe to the event.
Drag a new mediator onto the composite. In the “Create Mediator” dialog choose “Subscribe to Events” as template. Now add the “OrderPlacedEvent” by clicking the “plus” icon. If you like you can set a filter here too. For example you could only react on the event when the “cost” is over 100. Give the mediator a sensible name and click “Ok”. We can now create a “File Adapter” and write the order to a file.
Your project should now look something like this:
The entire composite with a publishing and subscribing mediator
The entire composite with a publishing and subscribing mediator
Deploy the project to the SOA server and give it a test run. You should see a log file being written to your file system on the specified location. (You could get 2 warnings while compiling. To get rid of these you have explicitly create a transformation map for both the mediators)
The message trace looks like this:
The order trace.
The order trace.
Last but not least a few notes for you to consider about EDN:
1. Scope
When an event is published, it will be published in the entire domain. This means you can publish an event in one composite and subscribe to it in an other composite. You can subscribe to an event from another composite by browsing to its .edl file when adding the event to your mediator.
Browsing for the EDL File
Browsing for the EDL File
This also means it might be hard to find out how many subscribers to an event there are in your domain and in which composite to find them.
2. Consistency
You can play around with the consistency of the event when you subscribe to it. You can choose one of three:
  • One and Only one
  • Guaranteed
  • Immediate
The exact meaning of each of them can be found here. In essence it will controll the way the event is delivered (transaction  and error handling)
So be careful to which use you put your events. It would be a poor job if you have a Business Critical process subscribed to an event which doesn’t get invoked because another subscriber to the same event throws an exeption. (This could happen when you have selected “immediate” consistency)
That’s it for now!