Friday, May 2, 2014

Transforming the SOAP message to REST XML message- OSB

Transforming the SOAP message to REST XML message- OSB

While invoking the REST interface from OSB with the content type defined as application\xml, the target system will expect the simple XML message without the target namespace specified.

The XSLT can be used to remove the name space from SOAP message but before performing this operation the SOAP envelope of the body variable should be removed
After removing the namespace the XML should be assigned to the body variable to send to target system.

Follow the below steps to achieve the same:

Remove SOAP Envelope:

The below XSLT will help as to remove the namespace from the XML.

Create a XSLT resource from SB console.
Add a Assign activity with the XSLT resource
Assign the output to a temp variable - var1.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
      </xsl:template>

      <xsl:template match="soapenv:*">
        <xsl:apply-templates select="@* | node()" />
  </xsl:template>
</xsl:stylesheet>

Removing Namespace:

The below XSLT will help as to add the target namespace to the XML.

Create a XSLT resource from SB console.
Add a Assign activity with the XSLT resouce  to remove the namespace from the variable var1
Assign the ouput to a temp variable - var2

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="*">
        <xsl:element name="{local-name()}">
            <xsl:apply-templates select="@* | node()" />
        </xsl:element>
    </xsl:template>
    <xsl:template match="@*">
        <xsl:attribute name="{local-name()}">
            <xsl:value-of select="." />
        </xsl:attribute>
    </xsl:template>
    <xsl:template match="text() | comment() | processing-instruction()">
        <xsl:copy />
    </xsl:template>
</xsl:stylesheet>

Assign the content of var2 to body:

Add replace activity to replace the node contents of body with var2




Unable to post the message to MQ through MQ adapter - Oracle SOA Suite

Unable to post the message to MQ through MQ adapter - Oracle SOA Suite

Sometimes we will be getting the below exception while posting the message to MQ  through MQ adapter in Oracle SOA Suite.

"Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Enqueue' failed due to: A webSphere MQ Error occurrred[while putting the message]. A webSphere MQ Error occurrred[while putting the message]. A webSphere MQ Error occurrred while putting the message in Queue: "EAI_ORD_RPLY_Q ". Please make sure that the Queue is Put enabled, not full, message do not exceeds maximum message length and QueueManger is up and running. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution."


Mainly this exception can occur if there is any issue with the MQ Adapter configuration or issue with the MQ server components.

The following steps can be followed to identify the issue.

MQ Adapter perspective:

Verify the MQSeriesAdapter health and state is fine


Verify the connection factory used in the Adapter is configured in weblogic server



Tuesday, April 29, 2014

Unable to get schema information for source - JDeveloper

Unable to get schema information for source - JDeveloper

I was getting the error "Unable to get schema information for source" while generating the XSL mapper file in the BPEL Transform activity through JDeveloper. The same error was coming while editing the existing mapper file in a transform activity with the same source variable.


But the component is getting deployed successfully and also the flows are working fine without any issue.

After the analysis i found that there is two schema's imported with the same name space into the wsdl and one of the them is used to create the message type for the source variable in the transformation.


Approaches to fix the issue

  •  Make sure the schema's are imported with different name space or create a consolidated schema and import the same 
  • Include the schema's that has the same names instead of importing them into the wsdl.



WLST script to set the XA Transaction timeout values for a data source in weblogic server

WLST script to set the XA Transaction timeout values for a data source in weblogic server


This tutorial explains the approach to set some of the important timeout properties for XA data sources in weblogic server through WLST script.

Set XA Transaction Timeout


Enables WebLogic Server to set a transaction branch timeout based on the value for XaTransactionTimeout.

When enabled, the WebLogic Server Transaction Manager calls XAResource.setTransactionTimeout() before calling XAResource.start, and passes either the XA Transaction Timeout value or the global transaction timeout.

XA Transaction Timeout


The number of seconds to set as the transaction branch timeout.
If set, this value is passed as the transaction timeout value in the XAResource.setTransactionTimeout() call on the XA resource manager, typically the JDBC driver.

When this value is set to 0, the WebLogic Server Transaction Manager passes the global WebLogic Server transaction timeout in seconds in the method.

If set, this value should be greater than or equal to the global WebLogic Server transaction timeout.


XA Retry Duration


Determines the duration in seconds for which the transaction manager will perform recover operations on the resource. A value of zero indicates that no retries will be performed.
XA Retry Interval

The number of seconds between XA retry operations if XARetryDurationSeconds is set to a positive value.

Please note the above configurations are only available to the data sources created with XA supported driver


WLST Script


The below wlst script set the required XA timeout properties

SetXATimeoutProperties.py
def setXATimeoutProperties():
   dsName='JDBC Data Source-0'
   edit()
   startEdit()
       
   server='AdminServer'
   cd("Servers/"+server)
   target=cmo
 
   print '========================================='
   print 'Setting the timeout properties for DataSource....'
   print '========================================='  
           
   cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaSetTransactionTimeout(true)cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaTransactionTimeout(3000)cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaRetryDurationSeconds(300)cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCXAParams/'+dsName)
   cmo.setXaRetryIntervalSeconds(60)save()
   activate()print 'Timeout settings for the datasource '+dsName+' has been completed'
 
 
def main():
     
    adminURL='t3://localhost:7001'
    adminUserName='weblogic'
    adminPassword='weblogic1'
    connect(adminUserName, adminPassword, adminURL)
    setXATimeoutProperties()
    disconnect()main()

Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/SetXATimeoutProperties.py

Before executing the script change the configuration values as required

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd SetXATimeoutProperties.py



Restart the server after successful execution. Now the XA configurations are enabled as required.



Monday, April 28, 2014

WLST script to set the JDBC Connection timeout properties in weblogic server

WLST script to set the JDBC Connection timeout properties in weblogic server


There are different timeout properties in JDBC connection, this tutorial explains the approach to set some of the important JDBC Connection timeout properties in weblogic server through WLST script.

Inactive Connection Timeout


The number of inactive seconds on a reserved connection before WebLogic Server reclaims the connection and releases it back into the connection pool.
You can use the Inactive Connection Timeout feature to reclaim leaked connections — connections that were not explicitly closed by the application.


Connection Reserve Timeout


The number of seconds after which a call to reserve a connection from the connection pool will timeout.
When set to 0, a call will never timeout.
When set to -1, a call will timeout immediately.


Statement Timeout


The time after which a statement currently being executed will time out.
A value of -1 disables this feature.
A value of 0 means that statements will not time out.


oracle.jdbc.ReadTimeout


The property oracle.jdbc.ReadTimeout helps to set read timeout while reading from the socket.

oracle.net.READ_TIMEOUT for jdbc versions < 10.1.0.5 oracle.jdbc.ReadTimeout for jdbc versions >=10.1.0.5


oracle.net.CONNECT_TIMEOUT


The property oracle.net.CONNECT_TIMEOUT helps to set the login time out in Oracle.
WLST Script

The below WLST script will help us to set the JDBC connection timeout properties

SetJDBCTimeoutProperties.py
def setJDBCTimeoutProperties():
   dsName='CRM6EAIReference'
   edit()
   startEdit()
       
   server='AdminServer'
   cd("Servers/"+server)
   target=cmo
 
   print '========================================='
   print 'Setting the timeout properties for DataSource....'
   print '========================================='  
           
   cd('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCDriverParams/'+dsName+'/Properties/'+dsName)
   #cmo.destroyProperty(getMBean('/JDBCSystemResources/'+dsName+'/JDBCResource/'+dsName+'/JDBCDriverParams/'+dsName+'/Properties/'+dsName+'/Properties/oracle.net.CONNECT_TIMEOUT'))
   cmo.createProperty('oracle.net.CONNECT_TIMEOUT')


Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/SetJDBCTimeoutProperties.py

Before executing the script, change the configurations as required.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd SetJDBCTimeoutProperties.py



Restart the server after successful execution. Now the JDBC connection timeout properties are set to the datasource.



Under advanced section