Monday, September 30, 2013

# 279 Oracle B2b Book - Chapters 5 - 11

Just to finish off my review of this book -

Chapter 5 - Setting up B2B Transactions
discusses the B2B lifecycle from creating documents, trading partner agreements, reporting and monitoring etc. It also introduces integration with SOA Suite and enterprise manager.

Chapter 6 - SOA Suite Integration
A step by step guide to creating a B2B SOA Composite. Also contains a very useful section
on B2B design best practices.

Chapter 7 - Reporting and Monitoring
Covers usage of B2B itself, Enterpise Manager and BAM for reporting purposes.
Explains succinctly what you get OOTB and how easy it is to provide value-add via BAM.

Chapter 8 - Exception Handling
Covers exception handling at B2B level ( inbound/outbound), SOA Composite level and also covers custom exception handling.

Chapter 9 - Oracle B2B Security Management
This chapter details the security features available OOTB with B2B along with the integration with Oracle FMW security infrastructure.

Chapter 10 - Preparing to go -live

The chapter title is self-explanatory - a must read!

Chapter 11 - Advanced Topics.
Covers Java callouts, the extremely valuable B2B Self-Service Utility along with the relevant APIS.
Again, a must read!

All in all an excellent book - heavy on examples - a real Hands-On...

Well done Scott et al.


Again, the Link

# 278 BPM API - Initiator Tasks

Here is my composite -






Here is the app link in Workspace











Now I want to initiate via the API.

First Kudos to Rommel Pino's post here

A great starting point -

Anyway - let's get a list of the Initiable Processes I have deployed, and then initiate the above process.

I create a project in jdev and include the following jars -












Code -

package initiatorapi;

import java.util.HashMap;
import java.util.List;

import java.util.Map;

import oracle.bpel.services.bpm.common.IBPMContext;
import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
import oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants;

import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;

import oracle.bpel.services.workflow.task.model.Task;

import oracle.bpm.client.BPMServiceClientFactory;

import oracle.bpm.services.client.IBPMServiceClient;
import oracle.bpm.services.instancemanagement.IInstanceManagementService;
import oracle.bpm.services.processmetadata.IProcessMetadataService;
import oracle.bpm.services.processmetadata.ProcessMetadataSummary;

public class InitiableProcesses {

    private static String url = "t3://localhost:7001";

    public InitiableProcesses() {
        super();
    }

    public void getInitiatiableProcesses() {
        System.out.println("getInitiatiableProcesses()");
        try {

            IProcessMetadataService service =
                getBPMServiceClient().getProcessMetadataService();
            IBPMContext bpmContext = getIBPMContext("weblogic", "welcome1");
            List initiableTasks =
                service.getInitiatableProcesses(bpmContext);
            for (ProcessMetadataSummary pms : initiableTasks) {
                System.out.println(pms.getProjectName() + "/" +
                                   pms.getProcessName());
                System.out.println("App Link " +
                                   pms.getApplicationLinkDisplayName());
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
       System.out.println(" #################### ");
     
    }

    public void initiateProcess(String processName) {
        System.out.println(" +++ initiateProcess() for " + processName);
        try {
            IBPMServiceClient ibsc = getBPMServiceClient();
            IProcessMetadataService service =
                getBPMServiceClient().getProcessMetadataService();
   
            IBPMContext bpmContext = getIBPMContext("weblogic", "welcome1");
            List initiableTasks =
           
                service.getInitiatableProcesses(bpmContext);
            for (ProcessMetadataSummary pms : initiableTasks) {
                System.out.println("++++ Process Name = " + pms.getProjectName() + "/" +
                                   pms.getProcessName());
                if (pms.getProcessName().equalsIgnoreCase(processName)) {
                    IInstanceManagementService ims =
                        ibsc.getInstanceManagementService();
                    Task task =
                        ims.createProcessInstanceTask(bpmContext, pms.getCompositeDN() +
                                                      "/" +
                                                      pms.getProcessName());
                    System.out.println("++++ Task title = " + task.getTitle());
                }

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void initiate() {

    }
    // Connect to WLS


    public static BPMServiceClientFactory getBPMServiceClientFactory() {
        Map properties =
            new HashMap();

        properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.CLIENT_TYPE,
                       WorkflowServiceClientFactory.REMOTE_CLIENT);
        properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL,
                       url);
        properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_INITIAL_CONTEXT_FACTORY,
                       "weblogic.jndi.WLInitialContextFactory");
        return BPMServiceClientFactory.getInstance(properties, null, null);
    }

    public static IBPMContext getIBPMContext(String username,
                                             String password) throws Exception {
        return getBPMServiceClientFactory().getBPMUserAuthenticationService().authenticate(username,
                                                                                           password.toCharArray(),
                                                                                           null);
    }

    public static IWorkflowServiceClient getIWorkflowServiceClient() {
        return getBPMServiceClientFactory().getWorkflowServiceClient();
    }

    public static IBPMServiceClient getBPMServiceClient() {
        return getBPMServiceClientFactory().getBPMServiceClient();
    }
    //

}

Test a couple of times -














I now log in to workspace as weblogic -







Now let's check the roles for this process -













Test the API with jstein/welcome1

I change the method so as to pass in user/pwd -































Re-test -





None found!

I can now expose this class as a web service -










I add the following jars -





So my libraries are as follows -













and deploy to WLS













Test













Login to workspace as jcooper










Thursday, September 12, 2013

#276 B2B Chapters 3 & 4


Chapter 3

B2B app development has a lot to do with document definitions. This chapter introduces one to the
Oracle Document Editor - B2B's design time authoring tool. Here you can create your B2B docs and also generate sample data and test validation.

Chapter 4

Deals with Trading Partner Management - essentially you are "configuring and tracking your endpoints outside of the enterprise boundaries". The authors go deep down into the functionality available here - the trading partner profiles - including message sequencing, delivery channels, agreements etc.

The Book