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>

Java webservice considering the space/newline characters as an element


Java webservice considering the space/newline characters as an element

We have developed a java webservice to convert the xml to fixed length payload; unfortunately it was failing with Class cast Exception.

<faultstring>java.lang.String cannot be cast to javax.xml.bind.JAXBElement</faultstring>

 
After debugging we have identified the parser considering the new line character in the XML payload as the JAXBElement.

 
We tried removing the new line characters and the spaces in the xml payload and it worked fine.



After a long struggle we have identified the root cause.

Wednesday, July 18, 2012

Undeploying SOA Composite while soa-infra is down in Oracle SOA Suite

Undeploying SOA Composite while soa-infra is down in Oracle SOA Suite:

Recently we had an issue with soa-infra start-up, soa-infra application won’t come up due to corrupt composite. 

We have followed the Meta link note 1380835.1 to un-deploy the corrupted composite and bring up the soa-infra application.

Thought of sharing the same here, it may help whoever facing the same issue.

The SOA composites can’t be un-deployed when the soa-infra application. The below steps will help you to un-deploy the SOA composites when the soa-infra application is down.
  • First check the soa logs and identify which composite is causing the problem
  • Download and copy the ShareSoaInfraPartition.ear file to $MWHOME/Oracle_SOA/common/bin
  • Execute $MWHOME/Oracle_SOA/common/bin/wlst.sh
  •  connect()
             Provide username, password and server URL
  • Run the below command to deploy ShareSoaInfraPartition.ear
                 deploy('ShareSoaInfraPartition','ShareSoaInfraPartition.ear',upload='true')
  • Now run the below command by changing the "toLocation" ('/fmw11g/Middleware' is some location path on SOA machine)
   exportMetadata(application='ShareSoaInfraPartition',server='AdminServer',toLocation='/fmw11g/Middleware',docs='/deployed-composites/deployed-composites.xml')
A deployed-composites folder will be created at "toLocation" path with deployed-composites.xml in it
  • Delete the composite which is causing the problem from deployed-composites.xml and save the file
          for example FormatDate composite like below
            <composite-series name="default/FormatDate" default="default/FormatDate!1.0">
                  <composite-revision dn="default/FormatDate!1.0" state="on" mode="active"   location="dc/soa_b8c8782b-776e-42c3-8519-d29fdfb72032">
                 <composite dn="default/FormatDate!1.0*soa_b8c8782b-776e-42c3-8519-d29fdfb72032"  deployedTime="2012-07-11T04:14:47.665-07:00"/>
                </composite-revision>
            </composite-series>
  • Now run the below command by changing the "fromLocation" (this should be the same location as previous)
            importMetadata(application='ShareSoaInfraPartition',server='AdminServer',fromLocation='/fmw11g/fmw1115/Middleware',docs='/deployed-composites/deployed-composites.xml')

 Now bounce your server and the composite will not be deployed by SOA when it comes up and hence that should bring your soa-infra up.

DOWNLOAD ShareSoaInfraPartition.zip