Thursday 11 July 2013

FILE ADAPTER : IgnoreZeroByteFile

PROBLEM DESCRIPTION:
--------------------
We are using FileAdapter 11.1.1.5.0 with SOASuite SyncReadMode to read 0 byte
data file. We don't want it cause exception,but it caused even we use IgnoreZeroByteFile Property="true" in
composite.xml.

EXPLANATION:
------------
The current behavior is expected .
In this  use case ,the file read uses a specific schema for it's translation
The property "IgnoreZeroByteFile" is only applicable to "opaque schema"

If you refer to the Table "36-5 Oracle File Adapter Properties" in the link
http://docs.oracle.com/cd/E14571_01/integration.1111/e10226/bc_config.htm

it clearly mentions that
" This parameter(IgnoreZeroByteFile)  is ignored if the schema for the
inbound file is anything other than opaque. "

So , for the current case , setting the property IgnoreZeroByteFile to
true/false would have no effect on the processing.

FAULT HANDLING : SCHEMA VIOLATED INPUT FILES

PROBLEM STATEMENT:
------------------
Schema violated input files are not moved to other directories as specified
in fault-policies.xml

In SOA Suite 11.1.1.5.0, customer has the following scenario where he wants
messages that are non compliant with xml schema be written to a file.

File Adapter Read -> BPEL -> File Adapter Write

The inbound file adapter has 'validateXML' set to true.
When a message is read that is not in compliance with xml schema, BPEL throws
'bpelx:invalidVaraibles' which is NonRecoverable System fault.

In fault-policies.xml, they have writeToFile action defined.

----------------------
<?xml version='1.0' encoding='UTF-8'?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<faultPolicy version="1.0" id="AsyncFireForgetFaultPolicy"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Conditions>
<faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages"
name="rjm:IndustryFlowS0015FileReadAdapter">
<condition>
<action ref="writeToFile"/>
</condition>
</faultName>
<faultName xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages"
name="rjm:IndustryFlowS0004FileReadAdapter">
<condition>
<action ref="writeToFile"/>
</condition>
</faultName>
...
...
<Action id="writeToFile">
<fileAction>
<location>/home/fusdevu/EDF_Yoyager_RejectedMessages/OTHERS</location>
<fileName>RejectedMessage_%TIMESTAMP%.xml</fileName>
</fileAction>
</Action>
<Action id="ora-human-intervention">
<humanIntervention/>
</Action>
<Action id="writeToMDMErrorFile">
<fileAction>
<location>/home/fusdevu/EDF_Yoyager_RejectedMessages/MDM</location>
<fileName>RejectedMessage_%TIMESTAMP%.xml</fileName>
</fileAction>
</Action>
</Actions>
</faultPolicy>
</faultPolicies>


EXLANATION:
----------
The current behavior (of the fault framework not being invoked) is expected and as per design.

Basically , the fault management framework would catch all faults (business
and runtime) for an invoke activity
[Refer to section
12.4 Using the Fault Management Framework in the link below
http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10224/bp_faults.htm#BABIGGIB]

Since , in the current test case the fault does not happen on an "invoke"
activity , the fault framework never gets executed.

Moreover , you should understand that the "validateXML" property is being set
on the partner-link and not on the FileAdapter Service itself - that means
that the FileAdapter "Read" will not validate the payload , but it would be
the "BPEL Receive Activity" which does the validation.

As mentioned before , since the fault framework will not be invoked on a
"BPEL Receive Activity Fault" the "invalidVariables" error would not be
handled by the fault framework.

The way to get past this issue would be  to validate the payload against the
schema at the FileAdapter Read Service itself  , so that the invalid file is
not passed on the BPEL Layer .

Please change the XSD  to include nxsd:validation="true" , remove
the "validateXML" property from the Partner-Link and redeploy the project
.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.example.org"
            targetNamespace="http://www.example.org"
            elementFormDefault="qualified"
             xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
              nxsd:validation="true">

This form of validation would control the publishing of invalid records and
provide information about XML validation errors.

Since the "fault" is now being thrown from the FileAdapter Service - the
fault framework would be invoked and the "writeFile" action would be
executed.

SOA WORKFLOW NOTIFICATION : CUSTOMIZE EMAIL HEADER PREFIXES


Workflow does support header customizations via "WorkflowCustomClasspathURL"

The customized resource bundles can be  packaged as a jar file and referred
from WorkflowCustomClasspathURL.

Please follow the steps below to customize the EMAIL headers:
1. Navigate to MW_HOME/Oracle_SOA1/soa/modules/oracle.soa.workflow_11.1.1
2. From the library bpm-services.jar extract the following directory to a local location:
    oracle/bpel/services/workflow/resource

Note:
-----
i. The reason , we extract these resource bundles from the SOA directory is
to be sure that we have the latest properties.
ii. Please make sure that the directory structure is maintained in the
extracted folder
iii. Delete the class file i18NUtil.class from the extracted directory
  
3. Make the following modifications in WorkflowLabels.properties 
  A. To customize "Action Required"
      TASK_VIEW_CONTEXT_ASSIGNEE_ASSIGNED=Action Required
      to
      TASK_VIEW_CONTEXT_ASSIGNEE_ASSIGNED=Customized Action Required
  B.  To customize "Routed"
      TASK_VIEW_CONTEXT_ROUTED=Routed
      to
      TASK_VIEW_CONTEXT_ROUTED=Action Required
  C. To customize "Completed to Approved" and "Completed to Rejected"
     Add
     TASK_VIEW_CONTEXT_ASSIGNEE_APPROVE=Approved
     TASK_VIEW_CONTEXT_ASSIGNEE_REJECT=Rejected
  Please repeat the procedure for any other languages by editing the
appropriate  translated WorkflowLabels_**.properties files.
.
 4. Zip back the entire folder into a jar file (say , customizedbundle.jar)
 5. The 'WorkflowCustomClasspathURL' parameter can be configured from the EM
SOA Console.
   [soa-infra - Administration - System MBean Broswer - Application Defined
MBeans - oracle.as.soainfra.config
          - Server: <Instance Name>
            - WorkflowConfig
              - human-workflow - WorkflowCustomClasspathURL)
   Provide the path to customizedbundle.jar
    => file:///{path_to_customizedbundle.jar}
 6. Click Apply
   Verify that the email subject contains the intended changes.

SOA WORKLIST : SQL AUTHENTICATOR


PROBLEM STATEMENT:
-------------------
Create sql authenticator as security provider.
The user "xc"(in administrator Group) defined in db can login weblogic console.
But when login
http://<host>:<port>/integration/worklistapp
it reports error:
User "xc" is not found in configuration "jazn.com" and the
exception was thrown repeatedly and it seems infinite redirection loop occurs
------------
Caused By: ORABPEL-10509

User not found.
User "xc" is not found in configuration "jazn.com"


EXPLANATION:
------------
The issue is caused because the worklist application only authenticates via
LDAP Authenticator and ignores SQLAuthenticator.

This is a know issue and has been address via a workaround.

Please refer to Note 1194815.1.
  Download the  attachment : workflow-120-SQLIdentityProvider.zip
  Copy dbprovider.jar from workflow-120-SQLIdentityProvider\lib
  to MW_HOME/user_projects/domains/{soa_domain}/lib
.
And follow the steps below:
1. Shutdown SOA and Admin Server
2. Navigate to MW_HOME/user_projects/domains/{domain_name}/config/fmwconfig
3. Backup jps-config.xml
4. Edit jps-config.xml and make the following modifications
  A. Modify
  <serviceInstanceRef ref="idstore.ldap"/> to
  <serviceInstanceRef ref="idstore.custom"/>
    under <jpsContext name="default">
  B. Add
     <serviceInstance name="idstore.custom" provider="custom.provider"
location="dumb">
<description>Custom Identity Store Service Instance</description>
<property name="idstore.type" value="CUSTOM"/>
<property name="ADF_IM_FACTORY_CLASS"
value="org.sample.providers.db.DBIdentityStoreFactory"/>
<property name="DB_SERVER_NAME" value="db_host_name"/>
<property name="DB_SERVER_PORT" value="db_port"/>
<property name="DB_DATABASE_NAME" value="db_sid"/>
<property name="ST_SECURITY_PRINCIPAL" value="db_user"/>       
<property name="ST_SECURITY_CREDENTIALS" value="db_passwd"/>   
</serviceInstance>
   under <serviceInstances>
     change the db_* parameters as per the environment
 C. Add
<serviceProvider type="IDENTITY_STORE" name="custom.provider"
class="oracle.security.jps.internal.idstore.generic.GenericIdentityStoreProvid
er">
              <description>Custom IdStore Provider</description>
</serviceProvider>
 within <serviceProviders> </serviceProviders>
.
5. Start SOA/Admin server
 Now logging on to worklist application should work.

Mediator FIFO Resequencer across groups

Mediator FIFO Resequencer across groups not processing the messages in the correct order.

Messages placed in the queue
   group 1 - 2 messages (msg1_1 msg1_2)
   group 2 - 4 messages (msg2_3 msg2_4 msg2_5 msg2_6)
   group 3 - 3 messages (msg3_7 msg3_8 msg3_9)

Process order: msg1_1 msg1_2 msg2_3 msg2_4 msg2_5 msg2_6 msg3_7 msg3_8 msg3_9

Expected behavior:
   process 1: msg1_1 msg2_3 msg3_7 (in any order)
   process 2: msg1_2 msg2_4 msg3_8 (in any order)
   process 3: msg2_5 msg3_9 (in any order)
   process 4: msg2_6

EXPLANATION:
-------------
Re-sequencer is not intended for sequencing across groups.
Mediator re-sequencer provides sequencing of messages within a group.

As clearly mentioned in section 22.2.2.1 Overview of the FIFO Re-sequencer
of link  :
http://docs.oracle.com/cd/E21764_01/integration.1111/e10224/med_resequencer.htm#CHDGJCDD

A FIFO re-sequencer would processes messages in sequence "for each group"
based on the arrival time.
The important thing to note in the above statement is - "for each group".
What this means is , a FIFO re-sequencer  would guarantee the sequential
processing of messages based on their arrival time "within each group"

A re-sequencer group is meant to provide "compartmentalization"
(i.e)
Each group would be processed as a separate entity (thread) and not depend on
other groups.
This is required, because , a failure in processing a group would not
interfere with the progression of messages in other groups.
The re-sequencer  guarantee  is that , the sequence would be maintained
within each group.

Consider the following example using FIFO:
12:00 AM , we en-queue 2 messages -     grp1-x , grp2-x
01:00 AM , we en-queue 2 messages -     grp1-y , grp2-y
02:00 AM , we en-queue 2 messages -     grp1-z , grp2-z

Now when the re-sequencer is started , the engine only guarantees that  the
messages within  each group will be sequenced in the order of arrival time.

So in this case , the guaranteed and expected de-queue  behavior is  that  ,
for each group the sequence will be maintained on basis of the arrival time
(i.e)
For group 1 - grp1-x(12:00),grp1-y(01:00),grp1-z(02:00)
and independently
For group 2 - grp2-x(12:00),grp2-y(01:00),grp1-z(02:00)

Again , since the re-sequencer is only meant for "sequencing  within group" ,
it's possible for the instances in EM to be something like
 -> grp1-x , grp2-x, grp2-y, grp2-z, grp1-y, grp1-z

As we can see grp1-x was processed by  lets say thread 1 , but before it
could process other messages another thread  (thread 2) completed the
sequence for grp2.
However ,as guaranteed ,  within each group the sequence has been maintained
as expected(x(at 12:00) followed by y(at 01:00) followed by z(at 02:00))

Re-sequencer is not meant for "re-sequencing across groups" .

XML-22015 :ora:getProcessId(),ora:getProcessVersion()

PROBLEM:
--------
While using XPath functions like ora:getProcessId(),ora:getProcessVersion()
SOA composite is failing with XML-22015: (Error) Function 'getProcessId' not
found.


EXPLANATION:
------------
The reported exception is expected.
BPEL XPath Functions (ora:functions) are not available from the "Component Palette" in Jdev for transformation.

The only way , the ora functions could have been included in the project is by editing the XSL manually from it's source view.

Since the ora functions are not available to the transformation engine , the exception is thrown.

It's important that we design the transformations based on the available list of functions , we cannot support functions that have not been exposed , but
included by editing the source .

BPEL 10G : Fetching audit trail using BPEL API

import java.util.Hashtable;

import javax.naming.Context;

import com.oracle.bpel.client.IInstanceHandle;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.ServerException;
import com.oracle.bpel.client.delivery.IDeliveryService;
import com.oracle.bpel.client.util.WhereCondition;


//Additional Imports
import org.w3c.dom.*;
import com.collaxa.xml.XMLHelper;
import com.collaxa.cube.engine.test.*;
import com.collaxa.cube.xml.dom.DOMUtil;


public class AuditRetreiver {
    public AuditRetreiver() {
    }

    public static void main(String[] args) {
        Locator locator;
        try {
            Hashtable<String, String> env = new Hashtable<String, String>();
            env.put(Context.PROVIDER_URL,
                    "ormi://localhost:12401/orabpel");
            env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
            env.put(Context.SECURITY_CREDENTIALS, "welcome1");
            env.put(Context.INITIAL_CONTEXT_FACTORY,
                    "com.evermind.server.rmi.RMIInitialContextFactory");
            locator = new Locator("default", env );
            locator.lookupService(IDeliveryService.SERVICE_NAME);

            long cikey = 140001;

            WhereCondition whereCikey = new WhereCondition("cikey = ?");
            whereCikey.setLong(1, cikey);

            IInstanceHandle[] instanceHandles = locator
                    .listInstances(whereCikey);

            for (int i = 0; i < instanceHandles.length; i++) {
                IInstanceHandle iInstanceHandle = instanceHandles[i];

            //Get the complete audit trail
            Element auditTrail = XMLHelper.parse(iInstanceHandle.getAuditTrail());

            //In case we want to print the audit trail
            System.out.println("Audit Trail : \n"+DOMUtil.toXML(auditTrail).toString());

            //Get the list of <details> element from <audit-trail>
            NodeList details = auditTrail.getElementsByTagName("details");

            //Get the first <details> element - this element would
            //indicate if reference details are stored in AUDIT_DETAILS
            //(e.g) <details id="0" />
            Element detailsElement = (Element)details.item(0);
            String detailId = detailsElement.getAttribute("id");

            //if detailId!=null , get the details stored in AUDIT_DETAILS table
            if (detailId!=null && !(detailId.trim().equals("")) )
            {
                System.out.println("Getting Audit Details from: AUDIT_DETAILS \n "+ iInstanceHandle.getAuditDetails(0));
            }
            //if detailId==null ,all details stored in AUDIT_TRAIL itself
            //proceed with getting the details from AUDIT_TRAIL
            else
            {
                System.out.println("Getting Audit Details from:AUDIT_TRAIL \n"+ BPELTestUtils.getElementText(detailsElement));

            }
       }

        } catch (ServerException e) {
            e.printStackTrace();
        }
        catch (Exception e) {
            e.printStackTrace();
        }

    }
}