Sunday, 17 July 2016

Sum of the resultant nodes of the apply template in XSLT


No Explanation, just a example with sample xml's and screen shots.

Request XML:



<?xml version="1.0" encoding="UTF-8" ?>
<process xmlns:ns0="http://xmlns.oracle.com/Application3/SampleProject/BPELProcess1">
   <mulWeight>
      <weight>800</weight>
      <UoMCodeWei>grm</UoMCodeWei>
   </mulWeight>
   <mulWeight>
      <weight>9000</weight>
      <UoMCodeWei>grm</UoMCodeWei>
   </mulWeight>
   <mulWeight>
      <weight>1000000</weight>
      <UoMCodeWei>mrm</UoMCodeWei>
   </mulWeight>
</process>






XSLT File:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns="http://xmlns.oracle.com/Application3/SampleProject/BPELProcess1"
                exclude-result-prefixes="msxsl">
  <xsl:template match="/process">
    <xsl:variable name="resultGroup">
      <xsl:apply-templates select="mulWeight"/>
    </xsl:variable>
    <processResponse>
      <result>
        <xsl:value-of select="sum(msxsl:node-set($resultGroup)/*)"/>
      </result>
    </processResponse>
  </xsl:template>
  <xsl:template match="mulWeight">
    <xsl:if test="UoMCodeWei='grm'">
      <result>
        <xsl:value-of select="weight div 1000"/>
      </result>
    </xsl:if>
    <xsl:if test="UoMCodeWei='mrm'">
      <result>
        <xsl:value-of select="weight div 1000000"/>
      </result>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>


Result XML :

<?xml version = '1.0' encoding = 'UTF-8'?>
<processResponse xmlns="http://xmlns.oracle.com/Application3/SampleProject/BPELProcess1">
   <result>10.8</result>
</processResponse>





Friday, 15 July 2016

Requested audit trail size is larger than threshold

Unable to open audit trial on EM Exception:Requested audit trail size is larger than threshold 1048576 chars
Error: Exception occured while retrieving the Flowtrace XML for the Composite Instancejava.lang.RuntimeException: oracle.soa.management.facade.DataSetTooLargeException: Requested audit trail size is larger than threshold 1048576 chars

To change instanceTrackingAuditTrailThreshold -
1. Right click on SOA-Infra and navigate till Audit Config
SOA_Infra ->Administration -> System Mbean Browser ->Application Defined MBeans ->oracl.as.soinfa.config ->Select server ->SoaInfraConfig -> soa-infra -> Audit Config

2. Change instanceTrackingAuditTrailThreshold value(In my case we have to raise it till 4 MB) and click Apply.

Thursday, 30 June 2016

DB Adapter Wizard Issue After Exporting The SAR

When there is scenario like we have exported the BPEL SAR file from EM Console and then trying to open the DB adapter wizard from JDeveloper, it doesn't open the wizard. We need to do the following work around to solve this,

Open the DB adapter wsdl file and add the .jca file name as mentioned below.

<?xml version='1.0' encoding='UTF-8'?>
<?binding.jca PL_INSERT_Data_db.jca?>

Monday, 6 June 2016

Steps to apply the patch in webLogic Server


Steps to apply the patch in webLogic Server

1)      Copy the below attached patch file local to your system.

2)      Extract the contents from the zip file. We will have a jar file and patch-catalog_xxx.xml.
Copy the files (AYBZ.jar and patch-catalog_22669.xml) to the appropriate cache_dir directory for the target system i.e, $MIDDLEWARE_HOME/utils/bsu/cache_dir.
Ex: /opt/fmw11g/utils/bsu/cache_dir

Note: The directory MW_HOME\utils\bsu\cache_diris created as the default patch download directory when you install Smart Update 3.3.0.

3)      Log in to the putty using target system credentials and run the below command to navigate to bsu folder.
cd /opt/fmw11g/utils/bsu

4)      Command to view the downloaded patches as below:[optional]
./bsu.sh -prod_dir=/opt/fmw11g/wlserver_10.3 -patch_download_dir=/opt/fmw11g/utils/bsu/cache_dir -status=downloaded -view -verbose
5)      Below is the command to install a patch
./bsu.sh -prod_dir=/opt/fmw11g/wlserver_10.3 -patchlist=AYBZ -verbose –install

6)      Command to check if the patch is installed:
./bsu.sh -prod_dir=/opt/fmw11g/wlserver_10.3 -status=applied -verbose –view

NOTE: We need to apply the Patches for WLS installation and not per domain. If we have a managed server in another machine in a domain (that is, set up with its own WLS installation), we need to install this patch on that other machine as well.
References:

2.       Reference doc to apply the patch:

Wednesday, 11 May 2016

Xquery to find duplciate data in the xml elements

Sample XML :
 <?xml version="1.0" encoding="UTF-8" ?>
<VehicleStatusData>
   <VehicleStatus>
      <position>
         <latitude>90.73</latitude>
         <longitude>100.73</longitude>
      </position>
      <status>
         <VehicleStatusEntry name="DOOR_POSITION_FRONT_LEFT" value="value12"/>
         <VehicleStatusEntry name="DOOR_POSITION_FRONT_LEFT" value="value14"/>
         <VehicleStatusEntry name="DOOR_POSITION_REAR_LEFT" value="value16"/>
      </status>
   </VehicleStatus>
</VehicleStatusData>

 Xquery to return duplicate data :
(:: pragma bea:global-element-parameter parameter="$vehicleStatusData1" element="VehicleStatusData" location="TeleWCDDIVHS.xsd" ::)

declare namespace xf = "http://tempuri.org/HelloWorld/sss/";

declare function xf:sss($vehicleStatusData1 as element(VehicleStatusData))
    {
        <DuplicateNames>
            {
             
                for $id in distinct-values($vehicleStatusData1/VehicleStatus/status/VehicleStatusEntry/@name)
                        where count($vehicleStatusData1/VehicleStatus/status/VehicleStatusEntry[@name eq $id]) gt 1
                        return $id
               
                 
            }
        </DuplicateNames>
};

declare variable $vehicleStatusData1 as element(VehicleStatusData) external;

xf:sss($vehicleStatusData1)

Wednesday, 28 October 2015

DB based MDS and adf-config.xml

Version 11.1.1.6 & 7

JDeveloper can be used to connect to DB based MDS. The steps to create DB based MDS are -


  1. Create DB connection to DEV_MDS.
  2. Create MDS connection (DB based) while selecting the db connection created in first step.
  3. Add that MDS connection to the repository and you are ready to refer the artifacts from DB based MDS.


Sometimes if adf-config.xml is not correct you may face below error while opening the application.

Error: oracle.fabric.common.FabricException: oracle.mds.config.MDSConfigurationException: MDS-01330: unable to load MDS configuration document 

MDS-01329: unable to load element "persistence-config"
MDS-01370: MetadataStore configuration for metadata-store-usage "mstore-usage_2" is invalid. 
MDS-00011: unable to create configuration object or MDSInstance due to invalid configuration information: oracle.mds.exception.MDSException: MDS-01373: unable to retrieve password. 
MDS-01373: unable to retrieve password.



Make sure that mstore-usage is defined correctly. Pasting the correct adf-config.xml here -
<metadata-namespaces>
          <namespace path="/deployed-composites/default"
                     metadata-store-usage="mstore-usage_2"/>
          <namespace path="/soa/shared" metadata-store-usage="mstore-usage_3"/>
        </metadata-namespaces>
        <metadata-store-usages>
          <metadata-store-usage id="mstore-usage_2">
            <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
              <property name="jdbc-userid" value="DEV_MDS"/>
              <property name="jdbc-password" value="password"/>
              <property name="jdbc-url"
                        value="jdbc:oracle:thin:@<ipaddress>:<port>:<SID>"/>
              <property name="partition-name" value="soa-infra"/>
            </metadata-store>
          </metadata-store-usage>

Friday, 9 October 2015

Decoding Base64 Encoded data using Java Embedding Activity

Recently faced critical issue while decoding Base64 encoded data.After doing lot of R&D finally achieved it by using Native Java Code.

Here are the step to step  process to achieve the same.
  1. Created String variable with the name "MyRowIDVar".
  2. Copied  Base64 encoded data into MyRowIDVar variable using Assign activity.
  3. Drag & Drop Java Embedding activity in middle of Bpel process and added below java code snippet in it.                                                              String rowid = (String)getVariableData("MyRowIdVar");       
    Base64Decoder Decoder = new Base64Decoder();   
    try                                          
     {             
        String decodedAmpersand = Base64Decoder.decode(rowid);  
        setVariableData("AA",Base64Decoder.decode(rowid));        
     }                                          
    catch(Exception e)                                          
     {                                          
        e.printStackTrace();                                           
     }
  4. we need to import required classes into bpel code  as shown below.
     <bpelx:exec import="oracle.soa.common.util.*" />
     <bpelx:exec import="java.lang.*" />
  5. When you open Bpel source code it should be looking like this.                            <bpelx:exec     import="oracle.soa.common.util.*"/>
    <bpelx:exec import="java.lang.*"/>
    <bpelx:exec name="DecodeBase64" version="1.5" language="java">
          <![CDATA[String rowid = (String)getVariableData("MyRowIdVar");       
       Base64Decoder Decoder = new Base64Decoder();   
       try                                          
       {             
          String decodedAmpersand = Base64Decoder.decode(rowid);  
          setVariableData("
    MyRowIdVar",Base64Decoder.decode(rowid));        
       }                                          
      catch(Exception e)                                          
      {                                          
        e.printStackTrace();                                           
      }]]>
    </bpelx:exec>
  6.  Finally in MyRowIdVar variable having Decoded Base64 data which can be processed further as per the requirement.
  7. Below are few screen shots for the reference.   
Keep Smile, Happy Coding..:)