Monday, July 30, 2012

JDBC LLR, table verify failed for table 'WL_LLR_ADMINSERVER'

JDBC LLR, table verify failed for table 'WL_LLR_ADMINSERVER'

I had some issue with the Oracle SOA Suite domain so that tried to delete and re-create the the domain with different name by using the same schema repository.

The domain creation was successful but when starting the server i was receiving the following error.

javax.transaction.SystemException: weblogic.transaction.loggingresource.LoggingResourceException: java.sql.SQLException: JDBC LLR, table verify failed for table 'WL_LLR_ADMINSERVER', row 'JDBC LLR Domain//Server' record had unexpected value 'BLOG_DOMAIN//AdminServer' expected
'blog_domain1//AdminServer'*** ONLY the original domain and server that creates an LLR table may access it ***
        at weblogic.transaction.internal.ServerTransactionManagerImpl.registerLoggingResourceTransactions(ServerTransactionManagerImpl.java:752)
        at weblogic.jdbc.common.internal.RmiDataSource.recoverLoggingResourceTransactions(RmiDataSource.java:302)
        at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:148)
        at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:97)
        at weblogic.jdbc.module.JDBCModule.activate(JDBCModule.java:359)
        Truncated. see log file for complete stacktrace


The issue is with the table WL_LLR_ADMINSERVER pointing to the old domain/server details.

Steps to resolve the issue

Update the table with the correct domain and the server details.

update SOA_SOAINFRA.WL_LLR_ADMINSERVER set RECORDSTR = 'BASE_DOMAIN//AdminServer' where  XIDSTR  = 'JDBC LLR BASE_DOMAIN1//Server';


Friday, July 27, 2012

Passing parameter to XSLT in Oracle SOA Suite 11g


Passing parameter to XSLT in Oracle SOA Suite 11g

Not like Oracle SOA Suite 10g, in Oracle SOA Suite 11g the parameters can be directly added into the Transform activity from GUI.
The parameters can be of any schema element type; the XML Schema Simple types are not accepted.

Create a schema definition that will have the parameter definition e.g.
Here, I have defined the schema to pass the parameters startIndex and endIndex to the XSLT.

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://schemas.oracle.com/parameters"
            targetNamespace="http://schemas.oracle.com/parameters"
            elementFormDefault="qualified">
 <xsd:element name="parameters">
    <xsd:complexType>
      <xsd:sequence>      
              <xsd:element name="startIndex" type="xsd:string"/>
              <xsd:element name="endIndex" type="xsd:string"/>
            </xsd:sequence>     
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Create the variable (e.g. parameters) of required element type defined in the schema, in my case the element name is parameters.


Open the Transform activity and select the Input/output variables. Add the parameters variable in the source section, the first variable that is added becomes the source for the transformation activity. These additional variables become as parameters to the transform file.


Monday, July 23, 2012

Invoking the Servlet through HttpAdapter with xml input/output in Oracle SOA Suite

Invoking the Servlet through HttpAdapter with xml input/output in Oracle SOA Suite

Sometimes we may require invoking the Java servlet with XML as input/output; this blog will explain how to invoke the servlet with XML as input/output  through HttpAdapter  in Oracle SOA Suite 11g. The same will work in Oracle SOA Suite 12c - the screens will be little different.

The sample java servlet will receive the emp name and emp no as XML input and return the employee details as XML output.

Defining the HttpAdapter to invoke the servlet:

  • Create a composite with Synchronous BPEL
  • Define the HttpAdapter as shown below
  • Make sure the configuration are defined as below


Friday, July 20, 2012

Splitting an array of repeated elements into sub groups based on index in XSL

Splitting an array of repeated elements into sub groups based on index in XSL

Sometimes we may require splitting the array of repeated elements into sub groups based on index in XSL; this blog will explain the approach to do the same.

The below XSLT will select the first two order line items from the list of line items.
The same can be used to select the elements by passing startIndex and endIndex values.

<xsl:stylesheet version="1.0"
                xmlns:xsdLocal="http://www.reuters.com/ns/2007/01/25/GCAP/EAI/OrderManagement"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="startIndex">1</xsl:variable>
<xsl:variable name="endIndex">2</xsl:variable>
  <xsl:template match="/">
    <xsdLocal:orderRequest>
      <xsl:for-each select="/xsdLocal:UserIdRequest/xsdLocal:orderLineItem[(position() >= $startIndex) and (position() &lt;= $endIndex)]">
        <xsdLocal:orderLineItem>
          <xsdLocal:CRMOLIId>
            <xsl:value-of select="xsdLocal:CRMOLIId"/>
          </xsdLocal:CRMOLIId>
          <xsdLocal:parentOrderItemId>
            <xsl:value-of select="xsdLocal:parentOrderItemId"/>
          </xsdLocal:parentOrderItemId>
          <xsdLocal:rootItemId>
            <xsl:value-of select="xsdLocal:rootItemId"/>
          </xsdLocal:rootItemId>
      </xsdLocal:orderLineItem>
      </xsl:for-each>
    </xsdLocal:orderRequest>
  </xsl:template>
</xsl:stylesheet>

Input XML:

<?xml version="1.0" encoding="UTF-8" ?>
<UserIdRequest  xmlns="http://www.reuters.com/ns/2007/01/25/GCAP/EAI/OrderManagement">
  
   <orderLineItem>
      <CRMOLIId>CRMOLIId529</CRMOLIId>
      <parentOrderItemId>parentOrderItemId530</parentOrderItemId>
      <rootItemId>rootItemId531</rootItemId>
    
   </orderLineItem>
   <orderLineItem>
        <CRMOLIId>CRMOLIId529</CRMOLIId>
      <parentOrderItemId>parentOrderItemId530</parentOrderItemId>
      <rootItemId>rootItemId531</rootItemId>
   </orderLineItem>
   <orderLineItem>
       <CRMOLIId>CRMOLIId529</CRMOLIId>
      <parentOrderItemId>parentOrderItemId530</parentOrderItemId>
      <rootItemId>rootItemId531</rootItemId>
   </orderLineItem>
  
    <orderLineItem>
       <CRMOLIId>CRMOLIId529</CRMOLIId>
      <parentOrderItemId>parentOrderItemId530</parentOrderItemId>
      <rootItemId>rootItemId531</rootItemId>
   </orderLineItem>
  
    <orderLineItem>
       <CRMOLIId>CRMOLIId529</CRMOLIId>
      <parentOrderItemId>parentOrderItemId530</parentOrderItemId>
      <rootItemId>rootItemId531</rootItemId>
   </orderLineItem>
  
    <orderLineItem>
       <CRMOLIId>CRMOLIId529</CRMOLIId>
      <parentOrderItemId>parentOrderItemId530</parentOrderItemId>
      <rootItemId>rootItemId531</rootItemId>
   </orderLineItem>
</UserIdRequest>

Output XML:

<?xml version = '1.0' encoding = 'UTF-8'?>
<xsdLocal:orderRequest xmlns:xsdLocal="http://www.reuters.com/ns/2007/01/25/GCAP/EAI/OrderManagement" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.reuters.com/ns/2007/01/25/GCAP/EAI/OrderManagement file:/D:/Albin/DevCodeBase/2012_R5/CRM_EAI_code_deploy/code/CRM61OM/CPFGOM_OrderSplitter/EAI.MSG.OM.125_OrderRequest.xsd">
   <xsdLocal:orderLineItem>
      <xsdLocal:CRMOLIId>CRMOLIId529</xsdLocal:CRMOLIId>
      <xsdLocal:parentOrderItemId>parentOrderItemId530</xsdLocal:parentOrderItemId>
      <xsdLocal:rootItemId>rootItemId531</xsdLocal:rootItemId>
   </xsdLocal:orderLineItem>
   <xsdLocal:orderLineItem>
      <xsdLocal:CRMOLIId>CRMOLIId529</xsdLocal:CRMOLIId>
      <xsdLocal:parentOrderItemId>parentOrderItemId530</xsdLocal:parentOrderItemId>
      <xsdLocal:rootItemId>rootItemId531</xsdLocal:rootItemId>
   </xsdLocal:orderLineItem>
</xsdLocal:orderRequest>


Finding the distinct values of an element in a XSL


Finding the distinct values of an element in a XSL

Sometimes we may have the requirement to identify the distinct elements in the input XML. Key function will help us to identify the distinct elements in the XSL.

The key () function returns a node-set from the document, using the index specified by an <xsl:key> element.

Syntax:

node-set key(string, object)
string - Specifies the name of an xsl:key element
object - A string to search for

The below XSL will find the distinct nextaction1 available in the XML.

TransDistinctNextAction1.xsl

<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsdLocal="http://www.reuters.com/ns/2007/01/25/GCAP/EAI/OrderManagement">
  <xsl:key name="orderlines-by-n1" match="/xsdLocal:extendedOrderRequest/xsdLocal:orderLineItem" use="xsdLocal:nextAction1"/>
 
  <xsl:template match="/">
    <xsdLocal:distinctNextActions>
      <xsdLocal:nextAction>
        <xsdLocal:nextAction1>
          <xsl:for-each select="/xsdLocal:extendedOrderRequest/xsdLocal:orderLineItem[generate-id(.) = generate-id( key('orderlines-by-n1', xsdLocal:nextAction1)[1])]">
            <xsdLocal:value>
              <xsl:value-of select="xsdLocal:nextAction1"/>
            </xsdLocal:value>
          </xsl:for-each>
        </xsdLocal:nextAction1>       
      </xsdLocal:nextAction>
    </xsdLocal:distinctNextActions>
  </xsl:template>
</xsl:stylesheet>


  <xsl:key name="orderlines-by-n1" match="/xsdLocal:extendedOrderRequest/xsdLocal:orderLineItem" use="xsdLocal:nextAction1"/>

                      Find the orderLineItems based on the nextaction1

          <xsl:for-each select="/xsdLocal:extendedOrderRequest/xsdLocal:orderLineItem[generate-id(.) = generate-id( key('orderlines-by-n1', xsdLocal:nextAction1)[1])]">

                        Find the unique nextaction1 values from the orderLineItems

Input XML:

<?xml version="1.0" encoding="UTF-8" ?>
<extendedOrderRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.reuters.com/ns/2007/01/25/GCAP/EAI/OrderManagement">
  
    <orderLineItem>
      <CRMOLIId>CRMOLIId36</CRMOLIId>
      <rootItemId>rootItemId37</rootItemId>
      <parentOrderItemId>parentOrderItemId38</parentOrderItemId>
      <actionCode>actionCode39</actionCode>     
      <nextAction1>nextAction175</nextAction1>     
   </orderLineItem>
   <orderLineItem>
      <CRMOLIId>CRMOLIId36</CRMOLIId>
      <rootItemId>rootItemId37</rootItemId>
      <parentOrderItemId>parentOrderItemId38</parentOrderItemId>
      <actionCode>actionCode39</actionCode>     
      <nextAction1>nextAction175</nextAction1>
   </orderLineItem>
   <orderLineItem>
      <CRMOLIId>CRMOLIId36</CRMOLIId>
      <rootItemId>rootItemId37</rootItemId>
      <parentOrderItemId>parentOrderItemId38</parentOrderItemId>
      <actionCode>actionCode39</actionCode>     
      <nextAction1>nextAction17</nextAction1>
   </orderLineItem>
</extendedOrderRequest>

Output XML:

<?xml version = '1.0' encoding = 'UTF-8'?>
<xsdLocal:distinctNextActions xmlns:xsdLocal="http://www.reuters.com/ns/2007/01/25/GCAP/EAI/OrderManagement" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <xsdLocal:nextAction>
      <xsdLocal:nextAction1>
         <xsdLocal:value>nextAction175</xsdLocal:value>
         <xsdLocal:value>nextAction17</xsdLocal:value>
      </xsdLocal:nextAction1>
   </xsdLocal:nextAction>
</xsdLocal:distinctNextActions>