Monday, May 22, 2017

DB Adapter stopped polling the record from the database table however the process health looks good

If the BPEL process health looks good, there is a chance that you could find error message in the log files about primary key value null.

If the DB Adapter is polling using the logical primary key (ie. database table doesn't have primary key on the table)  and the primary key value is null in at least one field of a record then that record will be picked and after that stops proceeding further.  This record will be in stuck positon.  And all the subsequent records won’t be polled.    So, delete all the bad primary key based records.  Then the remaining process will continue picking up by the Db adapter as usual.

Monday, April 10, 2017

How to send email opaque data as email attachment in soa 11g

Sometimes its required for us to read the file using file adapter and then send it as an email attachment.  When the file is read by DB adapter in binary format, means as an opaque  type variable then the data is in the encoded  format.

When we send the email in the attachment we have to add the original file contents as  a string.
So, we have to decode the content using base64 then attache it to the email activity.

To send the email as an attachment then below are the three key steps we need to do.

1. Import the java classes in the  bpel file, as the sub element of    ...
<process> element.
      <bpelx:exec import="oracle.soa.common.util.Base64Decoder"/&g

t;















































































&

amp;
lt
;bp
elx:exec import="oracle.soa.common.util.Base64Encoder"/>

2. Create a simple string type variable say , fileCont










ent




































;

 
 










 




































&lt
;variablefi name="leName" type="xsd:string"/>

3.  Assign the input variable's  opaque value to the string variable, to make the code











s

im









































































ple













;



 







































































































 

 





























  <assign name="Assign1">
            &lt;copy>
             <from>$Receive_Read_InputVariable.opaque
             <to>$fil









eCo



























nte

























nt





































 










































 








 


























  <c/opy&g
t;



 
 
  </assign>

4.  Now ad a JEmbededava activity  Write the below cod



















e.





















   addAuditTrailEntry("decoding












sta
rte

d")











;
 
























e
nco

Std











ed











St











rring ing











= (String)getVariableData("fileContent");
     oracle.soa.common.util.Base64Decoder Decoder = new oracle.soa.common.util.Base64Decoder();      addAuditTrailEntry("encoded String = "+encodedString);
     try
    {
        String decoded = oracle.soa.common.util.Base64Decoder.decode(encodedString);
        addAuditTrailEntry("decoded string = "+decoded);











   








    setVariableData("fileContent,"decod


ed)




;




 







}



    c





atc


h(E



xcepti

on e)






 {




 


 








addAud

itTrailEntry("Exception: "+e.getMessage());
    }


5.  Now finally in the email activity, go to the  Attachment tab and add new attachment button (+ green symbol)  then you see new line add the below content as shown below.  The file name you need to select either static or the dynamically through a variable as shown below.
In the encoding you can add manually  charset=UTF-8 



6. Here is the sample BPEL flow you can see for testing.

Now compile and test it.  Thats it.