Advertisements
RSS

Tag Archives: Java

Get value from inputtext in Oracle ADF

No rockit science this blogpost for the ADF gurus out there, but since I’m the new kid in town regarding Oracle ADF I decided to note down some of the stuff I found very usefull.

In our Oracle BPM project we generate our human task screens, however the customer wants them heavy modifed and at one time we needed the value of a inputtext component which had no binding.


FacesContext facesContext = FacesContext.getCurrentInstance();
 UIViewRoot root = facesContext.getViewRoot();
 RichInputText inputText = (RichInputText)root.findComponent("it1");
 String myString = inputText.getValue().toString();

Where value “it1” is the ID of your inputText component

Reference and all credits:

Advertisements
 
1 Comment

Posted by on 19-12-2012 in Oracle

 

Tags: , ,

Oracle Service Bus duplicate message check using Coherence

In a situation where you need some sort of duplicate message check for an Oracle Service Bus project you would need some custom code. Since the Oracle Service Bus is stateless, when it handles a proxy service  call it will not know if this specific message was handled before. So there needs to be some sort of logic in your service for validating it’s a new unique message id.

Giving the fact that every message on our ESB has an unique messageID element in the SOAP header we could store this on disk, database or in memory. With the help of Oracle Coherence this last option, in memory, is relatively simple.

remark: However these changes mentioned above (either disk, database or coherence) makes your stateless OSB a bit more statefull. Be carefull as developer or architect when you encounter requirements like these. The OSB wasn’t designed as a fast and stateless message handling ESB for nothing. We use this mechanism in a process flow with low message load where an old mainframe system with a custom (old) adapter occasionally (and unwanted) triggers duplicate messages. So in our case memory load is not a huge issue and we can proceed with our default monitoring tools).

Ok warnings there, so now let’s check our example custom SOAP header:


<tns:RubixHeader xmlns:tns="http://www.rubix.nl/header">
 <CorrelationId>AF1204DD-17D3-28A3-09A2-0888F2FFC123</CorrelationId>
 <MessageId>3F2504E0-4F89-11D3-9A0C-0305E82C3301</MessageId>
 <MessageType/>
 <Timestamp>2012-08-18T12:10:00</Timestamp>
 <Source/>
</tns:RubixHeader>

Every SOAP message through our OSB contains such a custom SOAP header and every messageID is generated as GUID and can be considered unique. So then a few lines of Java using the Coherence lib:

/**
 *
 */
package nl.rubix.coherence;

import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;
import weblogic.logging.LoggingHelper;
import java.util.logging.Logger;
// import com.tangosol.util.ConverterCollections.ConverterCollection;

/**
 * @author JvZoggel
 *
 */
public class OsbCoherenceHelper
{

 public OsbCoherenceHelper()
 {
 }

public static boolean CheckDuplicate(String messageid, String datetime)
 {
 NamedCache myCache = CacheFactory.getCache("mycache");
 boolean resultaat;
 Logger logger = LoggingHelper.getServerLogger();

 if (myCache.containsKey(messageid))
 {
 logger.warning(">> MessageID=" + messageid + " already exists with value=" + myCache.get(messageid));
 resultaat = true;
 }
 else
 {
 logger.warning(">> MessageID=" + messageid + " doesn't exists yet, now storing with value=" + datetime);
 myCache.put(messageid,datetime);
 resultaat = false;
 }
 return resultaat;
 }

public static String getValue(String messageid)
 {
 NamedCache myCache = CacheFactory.getCache("mycache");
 return myCache.get(messageid).toString();
 }

 public static String showValues()
 {
 NamedCache myCache = CacheFactory.getCache("mycache");
 return myCache.values().toString();
 }

 /**
 * @param args
 */
 public static void main(String[] args)
 {
 // CacheFactory.ensureCluster();
 // System.out.println(">>>> Cluster = " + CacheFactory.getCluster());
 // boolean x1 = CheckDuplicate("id0001","2001-10-26T21:00:00");
 // System.out.println("X1 = " + x1);
 // x1 = CheckDuplicate("id0001","2001-10-27T22:00:00");
 // System.out.println("X1 = " + x1);
 }
}

These few lines of code (ab)use the Coherence memory cache to store the XML message element MessageID as the Key and stores the element timestamp of the XML message as value. You could also store correlationID, or any other element, which might not be unique but this is not an issue for the Coherence values as long as the key is unique. The fact I use timestamp is to be able to create an overview of old messages (and maybe delete old keys with an additional Java method).

So let’s see how this looks like in the Oracle Service Bus:

Input for the callout are these 2 elements from our custom soap header. The result boolean variable is checked in the IF-THEN action. If TRUE then the proxy will throw an error because the message is a duplicate already passed earlier on.

Firing the service request to both managed servers results in the following logging:

Managed Server 1:

####<Aug 18 ..> <Warning> <> <server1.local> <rbx_osb_dev_01> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <..> <..> <BEA-000000> <>> MessageID=3D2504E0-4F89-11D3-9A0C-0305E82C3301 doesn't exists yet, now storing with value=2012-08-18T12:10:00>

and firing again to Managed Server 2:

####<Aug 18 ..> <Error> <> <server2.local> <rbx_osb_dev_02> <[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <..> <..> <BEA-000000> <>> MessageID=3D2504E0-4F89-11D3-9A0C-0305E82C3301 already exists with value=2012-08-18T12:10:00>

Remind yourself that by default we are using the default Coherence caching strategy which means we store these cache entries in the default Weblogic JVM which hosts the Oracle Service Bus services, messages, transformations, jdbc connection & jms modules. To protect your JVM you can use an external coherence server which is explained by William Markito Oliveira in his blog on OTN.

I really love the fact how Oracle integrated Coherence into OSB by extending the Business Service capabilities to use result caching (see blog from Mark Smith if you don’t know this feature). The code used in this blogpost is not rocket science and I hope to see features like this out-of-the-box in future upgrades of the Oracle Service Bus.

References:

 
6 Comments

Posted by on 20-08-2012 in Coherence, Java, Oracle, OSB

 

Tags: , , ,

JavaZone 2012

The JavaZone 2012 conference released this brilliant short movie called “The Java Heist”.
Looking at the amount of curse words, it’s obviously an European conference. ;-)

It’s all ones and zeros nowadays and that’s what we’re gonna be stealing here …

Enjoy!

 
Leave a comment

Posted by on 25-06-2012 in Java

 

Tags: ,

Weblogic EJB security roles

In my earlier blog I’ve mentioned the option for a Oracle Service Bus custom reporting provider and used a simple MDB to show the content of the report java objects. To make sure I have an example at my disposal at all time, and to help out in general: during deployment you might run into the next error/warning:

<Warning> <EJB> <BEA-010061> <The Message-Driven EJB: QueueMessageDrivenEJBBean is unable to  connect to the JMS destination: wli/reporting/jmsprovider/queue. The Error was: javax.naming.NoPermissionException: User <anonymous> does not have permission on wli.reporting to perform lookup operation.

The reason for this is the fact that your EJB wants to connect to the queue wli/reporting/jmsprovider/queue where unauthorised access is prohibited. If we check the queues security policy (select queue -> security -> policies) we can see that only 2 roles have authorisation:

So we can change the policy on the queue (not to be advised) or make sure our EJB uses proper authentication. The most basic version could be:

basic weblogic-ejb-jar.xml


<?xml version="1.0" encoding="UTF-8"?>
<!--weblogic-version:10.3.5-->
<wls:weblogic-ejb-jar xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.2/weblogic-ejb-jar.xsd">

<!-- this 1st segment is not necessary, if no run-as-principal-name is specified in
 run-as-role-assignment or in bean specific run-as-principal-name tag, then EJB container
 chooses first principal-name in the security-role-assignment below and uses that
 principal-name as run-as-principal-name -->
 <wls:weblogic-enterprise-bean>
 <wls:ejb-name>CustomOsbReportProvider</wls:ejb-name>
 <wls:run-as-principal-name>weblogic</wls:run-as-principal-name>
 </wls:weblogic-enterprise-bean>

<wls:security-role-assignment>
 <wls:role-name>adminsEJB</wls:role-name>
 <wls:principal-name>weblogic</wls:principal-name>
 </wls:security-role-assignment>
</wls:weblogic-ejb-jar>

basic ejb-jar.xml


<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<display-name>CustomOsbReportProvider </display-name>

<enterprise-beans>
 <message-driven>
 <ejb-name>CustomOsbReportProvider</ejb-name>
 <ejb-class>nl.rubix.CustomOsbReportHandler</ejb-class>
 <transaction-type>Container</transaction-type>
 <security-identity>
 <run-as>
 <description>EJB role used</description>
 <role-name>adminsEJB</role-name>
 </run-as>
 </security-identity>
 </message-driven>
 </enterprise-beans>

<ejb-client-jar>CustomOsbReportProviderClient.jar</ejb-client-jar>
</ejb-jar>

However with the help of the original JMSReportingProvider.jar it’s fairly easy to create a more elegant version:

deluxe weblogic-ejb-jar.xml

</pre>
<wls:weblogic-ejb-jar xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-ejb-jar http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.2/weblogic-ejb-jar.xsd">
 <!--weblogic-version:10.3.5-->

<wls:weblogic-enterprise-bean>
 <wls:ejb-name>CustomOsbReportProvider</wls:ejb-name>
 <wls:message-driven-descriptor>
 <wls:pool>
 <wls:max-beans-in-free-pool>100</wls:max-beans-in-free-pool>
 <wls:initial-beans-in-free-pool>3</wls:initial-beans-in-free-pool>
 </wls:pool>
 <wls:destination-jndi-name>wli.reporting.jmsprovider.queue</wls:destination-jndi-name>
 <wls:max-messages-in-transaction>5</wls:max-messages-in-transaction>
 </wls:message-driven-descriptor>
 <wls:transaction-descriptor>
 <wls:trans-timeout-seconds>600</wls:trans-timeout-seconds>
 </wls:transaction-descriptor>
 <wls:run-as-principal-name>alsb-system-user</wls:run-as-principal-name>
 </wls:weblogic-enterprise-bean>

<wls:transaction-isolation>
 <wls:isolation-level>TransactionReadCommitted</wls:isolation-level>
 <wls:method>
 <wls:description>Ensure the container starts a ReadCommitted transaction</wls:description>
 <wls:ejb-name>CustomOsbReportProvider</wls:ejb-name>
 <wls:method-name>*</wls:method-name>
 </wls:method>
 </wls:transaction-isolation>
 <wls:disable-warning>BEA-010001</wls:disable-warning>

</wls:weblogic-ejb-jar>
<pre>

deluxe ejb-jar.xml


</pre>
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
 <display-name>CustomOsbReportProvider </display-name>
 <enterprise-beans>
 <message-driven>
 <description>Custom Reporting Provider for OSB</description>
 <ejb-name>CustomOsbReportProvider</ejb-name>
 <ejb-class>nl.rubix.CustomOsbReportHandler</ejb-class>
 <transaction-type>Container</transaction-type>
 <message-destination-type>javax.jms.Queue</message-destination-type>
 <activation-config>
 <activation-config-property>
 <activation-config-property-name>acknowledgeMode</activation-config-property-name>
 <activation-config-property-value>Auto-acknowledge</activation-config-property-value>
 </activation-config-property>
 </activation-config>
 <security-identity>
 <run-as>
 <description>EJB role used</description>
 <role-name>ALSBSystem</role-name>
 </run-as>
 </security-identity>
 </message-driven>
 </enterprise-beans>

 <assembly-descriptor>
 <container-transaction>
 <method>
 <ejb-name>CustomOsbReportProvider</ejb-name>
 <method-name>*</method-name>
 </method>
 <trans-attribute>Required</trans-attribute>
 </container-transaction>
 </assembly-descriptor>

 <ejb-client-jar>CustomOsbReportProviderClient.jar</ejb-client-jar>
</ejb-jar>
<pre>

References:

 
Leave a comment

Posted by on 22-02-2012 in Weblogic

 

Tags: , , ,

Oracle Service Bus logging & tracing III – Creating a Custom Reporting Provider

In my earlier blogpost explaining the Oracle Service Bus Report Action I already mentioned the fact that Oracle allows you to create a custom report provider. Quote:

If you do not wish to use the JMS Reporting Provider that is provided with your Oracle Service Bus installation, you can untarget it and create your own reporting provider using the Reporting Service Provider Interface (SPI). If you configure your own reporting provider for messages, no information is displayed in the Oracle Service Bus Administration Console. You must to create your own user interface.

Since the report action places a java object on an internal JMS queue named wli.reporting.jmsprovider.queue we can play around with it from their.

Initially we wanted to discover what information this Java Object contained. So I’ve created a simple EJB project as an example named it CustomOsbReportHandler.


package local.rubix;
import java.util.logging.Logger;

import javax.annotation.Resource;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import javax.jms.TextMessage;

import weblogic.logging.LoggingHelper;

import com.bea.wli.reporting.jmsprovider.runtime.ReportMessage;

@MessageDriven(mappedName = "wli.reporting.jmsprovider.queue",
 name = "CustomReportHandler")

public class CustomOsbReportHandler implements MessageListener
{

 @Resource private MessageDrivenContext mdc;

 public void onMessage(Message inMessage)
 {
 TextMessage msg = null;
 Logger logger = LoggingHelper.getServerLogger();
 logger.warning("=====================");
 logger.warning("MDB inMessage: " + inMessage);
 try
 {
 if (inMessage instanceof TextMessage)
 {
 msg = (TextMessage) inMessage;
 logger.info("MDB unexpected text message received: " + msg.getText());
 }
 else if (inMessage instanceof ObjectMessage)
 {
 ObjectMessage myObject = (ObjectMessage) inMessage;
 logger.warning("MDB ObjectClass: " + myObject.getObject().getClass());
 String str_inMessageClassName = myObject.getObject().getClass().getSimpleName();
 logger.warning("MDB ObjectName: " + str_inMessageClassName);
 if (str_inMessageClassName.equals("ReportMessage"))
 {
 logger.warning("MDB ReportMessage found");
 ReportMessage myReportMessage = (ReportMessage)myObject.getObject();
 logger.warning("MDB getMetadata: " + myReportMessage.getMetadata());
 logger.warning("MDB getStrPayload: " + myReportMessage.getStrPayload());
 logger.warning("MDB getXmlPayload: " + myReportMessage.getXmlPayload());
 logger.warning("MDB getBinPayload: " + myReportMessage.getBinPayload());
 }
 else
 {
 logger.warning("MDB NO ReportMessage");
 }
 }
 else
 {
 logger.info("MDB unknown message");
 }
 logger.warning("=====================");
 }
 catch (JMSException e)
 {
 e.printStackTrace();
 mdc.setRollbackOnly();
 }
 catch (Throwable te)
 {
 te.printStackTrace();
 }
 }

}

This project was build with WLS/OSB 11.1.1.5 and the project uses the following libs:

  • com.bea.alsb.reporting.impl.jar
  • com.bea.core.xml.xmlbeans_2.1.0.0_2-5-1.jar
  • org.eclipse.persistence_1.1.0.0_2-1.jar
When you deploy your project don’t forget to untarget the default JMS Reporting Provider in the Weblogic console.

Output:

#### .... <BEA-000000> <=====================>
#### .... <BEA-000000> <MDB inMessage: ObjectMessage[ID:<786041.1329324233629.0>,com.bea.wli.reporting.jmsprovider.runtime.ReportMessage@9f0e4f]>
#### .... <BEA-000000> <MDB ObjectClass: class com.bea.wli.reporting.jmsprovider.runtime.ReportMessage>
#### .... <BEA-000000> <MDB ObjectName: ReportMessage>
#### .... <BEA-000000> <MDB ReportMessage found>
#### .... <BEA-000000> <MDB getMetadata: <rep:messagecontext xmlns:rep="http://www.bea.com/wli/reporting">
 <rep:content-encoding>UTF-8</rep:content-encoding>
 <rep:labels>CorrelationID=1234567890</rep:labels>
 <rep:inbound-endpoint name="ProxyService$LocalTest$services$ProxyService">
 <rep:service>
 <rep:operation>getEmployeeDetails</rep:operation>
 </rep:service>
 <rep:transport>
 <rep:uri>/service/employeedetails/v1</rep:uri>
 <rep:mode>request-response</rep:mode>
 <rep:qualityOfService>best-effort</rep:qualityOfService>
 </rep:transport>
 </rep:inbound-endpoint>
 <rep:origin>
 <rep:state>REQUEST</rep:state>
 <rep:node>PipelinePairNode1</rep:node>
 <rep:pipeline>PipelinePairNode1_request</rep:pipeline>
 <rep:stage>stageValidate</rep:stage>
 </rep:origin>
 <rep:timestamp>2012-01-11T16:20:08.874+01:00</rep:timestamp>
</rep:messagecontext>>
 <BEA-000000> <MDB getStrPayload: null>
#### .... <BEA-000000> <MDB getXmlPayload: <head:myHeader xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sr01="http://rubix.nl/schemas/cdm/sr01" xmlns:head="http://rubix.nl/schemas/cdm/header">
 <head:CurrentDateTime>2012-01-11T14:44:29.857Z</head:CurrentDateTime>
 <head:CorrelationID>1234567890</head:CorrelationID>
 <head:MessageID>1234567890.1</head:MessageID>
</head:myHeader>>
#### .... <BEA-000000> <MDB getBinPayload: null>
#### .... <BEA-000000> <=====================>

Which shows us that:

As expected the getXmlPayload & getBinPayload return either the expression you selected in the report action or null. Depending on what kind of input data you decided to use in your mapping. Much more interesting is the getMetadata method which returns the message reporting context, which is an XML type defined in the Oracle Service Bus MessageReporting.xsd. The coolest part here is the fact that it always contains the origin segment with variables you normally don’t have at your disposal in your OEPE mapper. This origin segment contains information as the state (REQUEST/RESPONSE/ERROR), node, pipeline and stage of the running process.

<rep:origin>
  <rep:state>REQUEST</rep:state>
  <rep:node>PipelinePairNode1</rep:node>
  <rep:pipeline>PipelinePairNode1_request</rep:pipeline>
  <rep:stage>stageValidate</rep:stage>
</rep:origin>

So now what ?

With the help of this information we started thinking about a proper database model to store the information needed for the support team. Now it was key to create a proper Reporting Data Handler which could replace the default JMS Reporting Provider.

The following code is based on the BEA example named SAMPLE-REPORTPROVIDER which can be downloaded here.

First the ApplicationLifecycleListener which registers our own ReportingHandler:

package nl.rubix;
import java.util.logging.Logger;

import weblogic.application.ApplicationLifecycleEvent;
import weblogic.application.ApplicationLifecycleListener;
import weblogic.logging.LoggingHelper;

import com.bea.wli.reporting.ReportingDataHandler;
import com.bea.wli.reporting.ReportingDataManager;

public class CustomOsbApplicationLifecycleListener extends ApplicationLifecycleListener
{

Logger logger = LoggingHelper.getServerLogger();

@Override
 public void postStart(ApplicationLifecycleEvent evt)
 {
 this.logger.warning("POST START");
 ReportingDataManager rmgr = ReportingDataManager.getManager();
 CustomOsbReportingDataHandler myHandler = new CustomOsbReportingDataHandler();
 ReportingDataHandler[] handlers = rmgr.getHandlers();
 myHandler.setHandlers(handlers);

// Remove the already installed handlers
 for (ReportingDataHandler h: handlers)
 {
 rmgr.removeHandler(h);
 }
 rmgr.addHandler(myHandler);
 this.logger.warning("POST START - add handler: " + myHandler.toString());
 }

 @SuppressWarnings("null")
 @Override
 public void preStop(ApplicationLifecycleEvent evt)
 {
 this.logger.warning("PRE STOP");
 ReportingDataManager rmgr = ReportingDataManager.getManager();
 ReportingDataHandler[] handlers = rmgr.getHandlers();
 CustomOsbReportingDataHandler myHandler = null;
 // Remove the already installed handlers
 for (ReportingDataHandler h: handlers)
 {
 if (h instanceof CustomOsbReportingDataHandler)
 {
 myHandler = (CustomOsbReportingDataHandler)h;
 }
 rmgr.removeHandler(h);
 }

handlers = myHandler.getHandlers();
 if (handlers != null)
 {
 // Install the original handlers back
 for (ReportingDataHandler h: handlers)
 {
 rmgr.addHandler(h);
 }
 }
 }
}

Second our own ReportDataHandler:

package nl.rubix;
import java.io.InputStream;
import java.io.Serializable;
import java.util.logging.Logger;

import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlTokenSource;

import weblogic.logging.LoggingHelper;

import com.bea.wli.reporting.MessagecontextDocument;
import com.bea.wli.reporting.ReportingDataHandler;

public class CustomOsbReportingDataHandler implements ReportingDataHandler
{
 Logger logger = LoggingHelper.getServerLogger();

public CustomOsbReportingDataHandler()
 {
 // i know nothing ...
 }

 @Override
 public void close()
 {
 // TODO Auto-generated method stub
 this.logger.warning("CLOSE");
 }

@Override
 public void flush() {
 // TODO Auto-generated method stub
 this.logger.warning("FLUSH");
 }

@Override
 public void handle(XmlObject metadata, String str) throws Exception {
 // Handling OSB Alert/Report expression mapping containing String data
 this.logger.warning("handle XMLObject/String");
 }

@Override
 public void handle(XmlObject metadata, InputStream is) throws Exception {
 // Handling OSB Alert/Report expression mapping containing InputStream data
 this.logger.warning("handle XML/InputStream");
 is.mark(0);
 is.reset();
 }

@Override
 public void handle(XmlObject metadata, XmlObject data) throws Exception {
 // Handling OSB Alert/Report expression mapping containing XML data (expected behaviour)
 this.logger.warning("handle XMLObject/XMLObject");
 handleReportXMLdata( metadata, data);
 }

@Override
 public void handle(XmlObject arg0, XmlTokenSource arg1) throws Exception {
 // Handling OSB Alert/Report expression mapping containing XMLTokenSource data
 this.logger.warning("handle XMLObject/XmlTokenSource");
 }

@Override
 public void handle(XmlObject arg0, Serializable arg1) throws Exception {
 // Handling OSB Alert/Report expression mapping containing Serializable data
 this.logger.warning("handle XMLObject/Serializable");
 }

public void setHandlers(ReportingDataHandler[] handlers) {
 // TODO Auto-generated method stub
 this.logger.warning("setHandlers");
 }

public ReportingDataHandler[] getHandlers()
 {
 // TODO Auto-generated method stub
 this.logger.warning("getHandler");
 return null;
 }

 private void handleReportXMLdata(XmlObject metadata, XmlObject data)
 {
 this.logger.warning("handleReportData kicked in");
 try
 {
 // check if Report message
 if( metadata instanceof MessagecontextDocument )
 {
 this.logger.warning("ReportMetadata = " + metadata.xmlText());
 this.logger.warning("ReportData = " + data.xmlText());
 }
 /* else if( metadata instanceof AlertcontextDocument )
 {
 this.logger.warning("AlertMetadata = " + metadata.xmlText());
 }*/
 }
 catch(Exception e)
 {
 e.printStackTrace();
 }
 }

}

During startup of our Weblogic server we can see in the logging the handler is registered.

<Warning> <> <BEA-000000> <POST START>
<Warning> <> <BEA-000000> <setHandlers>
<Warning> <> <BEA-000000> <POST START - add handler: nl.rubix.CustomOsbReportingDataHandler@396c77>

When triggering a Proxy Service which contains a Report action where $header is mapped in expression and $header/correlationID is mapped in a Key we see the following output:

<Warning> <> <BEA-000000> <handle XMLObject/XMLObject>
<Warning> <> <BEA-000000> <handleReportData kicked in>
<Warning> <> <BEA-000000> <ReportMetadata = <rep:messagecontext xmlns:rep="http://www.bea.com/wli/reporting">..............</rep:messagecontext>>
<Warning> <> <BEA-000000> <ReportData = <head:myHeader xmlns:head="http://rubix.nl/schemas/cdm/header">..............</head:myHeader>>

Why … 

From here you can decide on multiple solutions like storing the messagecontext and/or expression in a Oracle database which is the most obvious solution. By this creating your own audit & tracing solution for your organization needs.

Two of the biggest problems I have with the default reporting provider is the fact the messagecontext contains interesting data as a full timestamp but the record is stored containing only the message date. Besides that the default version dumps the full expression in a BLOB field. Both result in a limitation regarding querying for specific events.

Report actions + Custom Report provider + a custom SOAP Header definition + proper correlation through your services + good database model = very nice audit and tracing capabilities.

**updates**
2013-06-13 – added blogpost reference Edwin Biemond with detailed Java examples

References:

You can find more examples here:
Oracle Forums: https://forums.oracle.com/forums/thread.jspa?threadID=817677
Java.net: http://java.net/projects/oracleservicebus1031/downloads?page=2&theme=java.net
Edwin Biemond: Custom Reporting Provider

 
8 Comments

Posted by on 15-02-2012 in Oracle, OSB

 

Tags: , ,

Java JDK installshield bug on Windows

I keep running into weird stuff with Windows as a server platform.

Java JDK installer fails to install at the step where you can select the components and the install path and press Next.

The error message is:
A path with a semi colon in it, is not supported for this product. Please select a directory path without a semi-colon

Weird thing here is that the installpath doesnt contain any semi-colon but is simply “c:\java\jdk1.6.0_24”. The error is just misleading and probably a bug in the Installshield software. I think the error occurs when the source path of the installer executable is located in a path which is to long.

Try to move the installer to the root of your system c:\ and try again.
This fixed it for me.

 
3 Comments

Posted by on 21-06-2011 in Java, Oracle

 

Tags:

Weblogic and Triple-DES decryption

After my earlier post regarding the Triple DES encryption Weblogic uses. The next question could be, can we decrypt the 3DES hash to cleartext again ? The answer is, yes you can.

On the Internet multiple examples are available, but I found this post from Chris Vugrinec ( hi m8 ) very helpfull so muchos credits to Chris.

Off course the java code needs to include the weblogic.jar and on runtime access to the domains SerializedSystemIni.dat which encapsulates a time-variant encrypted key created with the generation of the domain.

import java.io.Console;
import weblogic.security.internal.SerializedSystemIni;
import weblogic.security.internal.encryption.ClearOrEncryptedService;

public class DrieDesDecrypter
{
  static ClearOrEncryptedService ces;
  public static void main(String[] args)
  {
System.out.println("This class decrypts the 3DES string for Weblogic");
    Console console = System.console();
    String var_folder = console.readLine("Give PATH! where SerializedSystemIni.dat for weblogic domain is located: ");
    String var_driedes = console.readLine("Give 3DES string: ");
    ces = new ClearOrEncryptedService(SerializedSystemIni.getEncryptionService(var_folder));
    var_driedes = var_driedes.replace("\\", "");
    System.out.println("Decrypted value: " + ces.decrypt(var_driedes));
  }
}

The 1st input is the Directory where the SerializedSystemIni.dat resides
The 2nd input is the encrypted 3DES String
The output  is what you wanted.
Running would look something like:

c:\Oracle\domains\rbx_dev_wls\bin\setDomainEnv.cmd
java DrieDesDecrypter

This class decrypts the 3DES string for Weblogic
Give PATH! where SerializedSystemIni.dat for weblogic domain is located: C:\Oracle\domains\rbx_dev_wls\security
Give 3DES string: {3DES}OOLr88wGSPx82H1abcYU9Q==
Decrypted waarde: welcome1

This source-code should trigger any Weblogic Administrator to make sure it’s SerializedSystemIni.dat file is secured to prevent unauthorised access and included in the backup procedure.

Update 2012.01.26:

Due to lost passwords on a DEV environment I had to test my class with the new AES encryption used by Weblogic 11g (r1PS4) instead of the older 3DES algoritm it used to store it’s passwords in. And it still works like a charm. :)

Update 2012.06.27:

Make life much easier for those DEV/TST domains: http://recover-weblogic-password.appspot.com/
Don’t think I would like to use it for my PRD domains, but you make your own choice there,

 


 
1 Comment

Posted by on 12-04-2010 in Oracle, Weblogic

 

Tags: , , ,