Wednesday, January 30, 2013

JAX-WS webservice client basic authentication

JAX-WS webservice client basic authentication:


Sometimes we may need to create a webservice client for a JAX-WS webservice that require the basic authentication.
This post will explain the how to pass the username/password when invoking the basic authentication enabled web services from the client.

Java client with basic authentication details:

import java.util.*;
import javax.xml.ws.*;
import weblogic.wsee.security.unt.ClientUNTCredentialProvider;
import weblogic.xml.crypto.wss.WSSecurityContext;
import weblogic.xml.crypto.wss.provider.CredentialProvider;

public class DataObjectOperationsByNameClient
{
  @WebServiceRef
  private static DataObjectOperationsByName_Service dataObjectOperationsByName_Service;
  public static void main(String [] args)
  {
    dataObjectOperationsByName_Service = new DataObjectOperationsByName_Service();
    DataObjectOperationsByName dataObjectOperationsByName = dataObjectOperationsByName_Service.getDataObjectOperationsByName();
    String input="<DataObject Name=\"BAMWebservice\" Path=\"/Albin\">\n" + "<Contents>\n" + "<Row>\n" + "<Column Name=\"Field1\" Value=\"Albin\" />\n" +
    "<Column Name=\"Field2\" Value=\"I.T\" />\n" +"<column Name=\"Field3\" Value=\"TR\" />\n" +"</Row>\n" + "</Contents>\n" + "</DataObject>\n";   
      String USERNAME = "weblogic";
      String PASSWORD = "welcome1";
        try {
            BindingProvider bindingProvider = (BindingProvider) dataObjectOperationsByName;
            Map<String,Object> rc = (Map<String,Object>)bindingProvider.getRequestContext();
            List<CredentialProvider> credProviders = new ArrayList<CredentialProvider>();
            credProviders.add(new ClientUNTCredentialProvider(
USERNAME .getBytes(),PASSWORD .getBytes()));
            rc.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);
            rc.put(BindingProvider.USERNAME_PROPERTY, USERNAME);
            rc.put(BindingProvider.PASSWORD_PROPERTY, PASSWORD);;

            dataObjectOperationsByName.insert(input);
        } catch (BAMWebServiceException e) { e.printStackTrace();      }
  }
}



Friday, December 21, 2012

Building a Simple Oracle ADF page using Oracle BAM Data Control

Building a Simple Oracle ADF page using Oracle BAM Data Control

This blog will explain how to Build a Simple Oracle ADF page using Oracle BAM Data Control

The Oracle BAM reports can be built through BAM Active Studio or through BAM data control in Oracle ADF page.
In this blog I will be explaining about the steps required to build a simple ADF page using BAM data control.

Creating the BAM Connection:

  • Open the JDeveloper
  • Create new BAM Connection

  • Enter the BAM Server details as shown below. 

  • Click on Finish and Test the connection
  • Create the data object in BAM through Architect view (I am using the existing data object Employee)



Thursday, December 20, 2012

Runtime Exception in Oracle ADF application with Oracle BAM Data Control - Failed handling event FirstGetOnDataProvider on QueryConfigured

Runtime Exception in Oracle ADF application with Oracle BAM Data Control - Failed handling event FirstGetOnDataProvider on QueryConfigured


We may receive the following exception while running the Oracle ADF application with Oracle BAM Data Control configured into that.

<Dec 19, 2012 3:07:06 AM PST> <Error> <oracle.tip.tools.ide.bam.dc.rt.fsm.StateMachine> <BEA-000000> <Failed handling event FirstGetOnDataProvider on QueryConfigured>
<Dec 19, 2012 3:07:06 AM PST> <Warning> <oracle.adf.controller.faces.lifecycle.Utils> <BEA-000000> <ADF: Adding the following JSF error message: Failed handling event FirstGetOnDataProvider on QueryConfigured
oracle.tip.tools.ide.bam.dc.rt.fsm.exception.TransitionFailureException: Failed handling event FirstGetOnDataProvider on QueryConfigured
        at oracle.tip.tools.ide.bam.dc.rt.fsm.StateMachine.internalHandle(StateMachine.java:249)
        at oracle.tip.tools.ide.bam.dc.rt.fsm.StateMachine.handle(StateMachine.java:151)
        at oracle.tip.tools.ide.bam.dc.rt.provider.paging.PagingCollection$PagingIterator.<init>(PagingCollection.java:272)
        at oracle.tip.tools.ide.bam.dc.rt.provider.paging.PagingCollection$PagingIterator.<init>(PagingCollection.java:234)
        at oracle.tip.tools.ide.bam.dc.rt.provider.paging.PagingCollection.iterator(PagingCollection.java:152)
        at oracle.adf.model.bean.DCDataVO.buildProviderIterator(DCDataVO.java:1319)
        at oracle.adf.model.bean.DCDataVO.access$100(DCDataVO.java:86)
        at oracle.adf.model.bean.DCDataVO$DCObjectAdapter.refreshIterator(DCDataVO.java:2923)
        at oracle.adf.model.bean.DCDataVO.executeQueryForCollection(DCDataVO.java:404)
        at oracle.tip.tools.ide.bam.dc.dt.adapter.BAMDataControlDataVO.executeQueryForCollection(BAMDataControlDataVO.java:83)
        at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:1217)
        at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:1397)
        at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:1303)
        at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:1288)
        at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:7107)
        at oracle.adf.model.bean.DCBeanDataControl.executeIteratorBindingIfNeeded(DCBeanDataControl.java:990)
        at oracle.tip.tools.ide.bam.dc.dt.adapter.BAMAdapterDCService.executeIteratorBindingIfNeeded(BAMAdapterDCService.java:235)
        at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:2160)
        at oracle.jbo.uicli.binding.JUCtrlHierBinding.getRootNodeBinding(JUCtrlHierBinding.java:95)
        at oracle.adfinternal.view.faces.model.binding.RowDataManager.getParent(RowDataManager.java:251)
        at oracle.adfinternal.view.faces.model.

The issue is because of the BAM connection details are not configured in the EM console after the deployment of the application.

If we are deploying the application to the stand alone server, the Oracle BAM connection must be re-created in Oracle Fusion Middleware Control Console after the deployment of the application.
Also application must be deployed using MDS enabled otherwise the connection details will not be persisted.

Steps to resolve this issue:

Enable the MDS for the Application:

  • Right click on the project and Select Project Properties.


Problem while deploying Oracle ADF application - java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet

Problem while deploying Oracle ADF application - java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet


Sometimes we may receive the following exception while deploying the Oracle ADF application to the server.

weblogic.application.ModuleException: Failed to load webapp: 'BAPReport.war'
        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:395)
        at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        Truncated. see log file for complete stacktrace
The issue is the oracle.adf.library.webapp.ResourceServlet class is missing in the class path.This issue can be resolved by deploying the application as EAR file instead of deploying the project as WAR file.

Steps to resolve the issue:

  • Right click on the application and select Application properties

  • Select Deployment and click on New



Tuesday, December 18, 2012

Send the reports to external email ids through Alerts - Oracle BAM server.

Send the reports to external email ids through Alerts - Oracle BAM server.

By default we can’t send the reports to an external email id’s from a Oracle BAM server, the reports only can be send to a users configured with Oracle BAM servers(through weblogic console).This post will explain how to enable the Oracle BAM server to send the reports to the external email ids.

Before following this post the email drivers details should be configured in UMS (through em console).

By default AlertActionAllowExternalEmail property in the BAMCommonConfig.xml file is set as false.
Change the value of AlertActionAllowExternalEmail property to true in the BAMCommonConfig.xml file to enable the external email feature. The BAMCommonConfig.xml file can be located in the following location BAM_DOMAIN_HOME/BAMDomain/config/fmwconfig/servers/BAMManagedServer/applications/oracle-bam_11.1.1/config.

 Create an Alert to send the report to the External Email:

  • Login to the Architect window; select the Alert from the drop down list and click on Create New Alert.