Sunday Sep 18, 2011

Composite Invocation Changed from PS4(11.1.1.5)

As described in
http://download.oracle.com/docs/cd/E21043_01/apirefs.1111/e10659/oracle/soa/management/facade/Service.html#post_java_lang_String__oracle_fabric_common_NormalizedMessage_


Service invocation using oracle.soa.management.facade.Service is deprecated from PS4.

Instead, oracle.soa.api.DirectConnection is recommended further on. Here is the basic sample code:

try {

String operationName = "process";

String xml = "<ns1:process xmlns:ns1=\"http://xmlns.oracle.com/BPMTestApp/InvokeSOATest/AsyncBPEL\"><ns1:input></ns1:input></ns1:process>";


// domainName, compositeName, revision

CompositeDN compositeDN = new CompositeDN("default",

"InvokeSOATest", "1.0");

// DirectConnection - oracle-soa-client-api.jar

Locator compositeLocator = null;


Hashtable<String, String> jndiProps = new Hashtable();

jndiProps.put(Context.PROVIDER_URL,

"t3://jlee-soa11:7001/soa-infra");

jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,

"weblogic.jndi.WLInitialContextFactory");

jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");

jndiProps.put(Context.SECURITY_CREDENTIALS, "welcome1");


compositeLocator = LocatorFactory.createLocator(jndiProps);

// compositeDN, serviceName

DirectConnection dic = compositeLocator.createDirectConnection(

compositeDN, "DirectBinding");


// create a std dom parser

DOMParser parser = new DOMParser();

parser.parse(new InputSource(new StringReader(xml)));


Element element = parser.getDocument().getDocumentElement();

Map<String, Element> payload = new HashMap<String, Element>();

payload.put("payload", element);

Message<Element> xmlMessage = XMLMessageFactory.getInstance()

.createMessage(payload);


dic.post(operationName, xmlMessage);

} catch (Exception e) {

e.printStackTrace();

}


hope this helps.

Tuesday Sep 01, 2009

Task Detail page sample for 11g

I've come across many customers who want to customize the HW detail page for their own. In this post, I'll attach the very basic page u can use, so you don't have to start it from scratch.

sample jsp as below:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<%@ page contentType="text/html;charset=EUC-KR"%>

<%@ page import="java.util.*,oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants,com.oracle.jay.WorklistClient,oracle.bpel.services.workflow.client.IWorkflowServiceClient, oracle.bpel.services.workflow.verification.IWorkflowContext,oracle.bpel.services.workflow.client.WorkflowServiceClientFactory,oracle.bpel.services.workflow.query.ITaskQueryService,oracle.bpel.services.workflow.task.model.Task"%>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"/>

    <title>taskdetailtest</title>

  </head>

  <body>

    <%

    

    String bpmWorklistTaskId = request.getParameter("bpmWorklistTaskId");

    String bpmWorklistContext = request.getParameter("bpmWorklistContext");

    

Map<IWorkflowServiceClientConstants.CONNECTION_PROPERTY,java.lang.String>

properties = new

HashMap<IWorkflowServiceClientConstants.CONNECTION_PROPERTY,java.lang.String>();


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.MODE, IWorkflowServiceClientConstants.MODE_DYNAMIC);


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:8001");


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "welcome1");


properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "weblogic");


IWorkflowServiceClient client = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT, properties, null);


IWorkflowServiceClient wfSvcClient =

WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.SOAP_CLIENT,

properties, null);


    //IWorkflowServiceClient wfSvcClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.JAVA_CLIENT);

    IWorkflowContext ctx = null;

    ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();

    ctx = querySvc.getWorkflowContext(bpmWorklistContext);

    

    Task humanTask = querySvc.getTaskDetailsById(ctx, bpmWorklistTaskId);

    

    out.println("<br>Task Number: " + humanTask.getSystemAttributes().getTaskNumber());

    out.println("<br>Task Id: " + humanTask.getSystemAttributes().getTaskId());

    out.println("<br>Title: " + humanTask.getTitle());

    out.println("<br>Pri ority: " + humanTask.getPriority());

    out.println("<br>State: " + humanTask.getSystemAttributes().getState());

    out.println();

  %>

  </body>

</html>


once you are done with the page, you have to change the url link that redirect to the detailed page when you click on the worklist application.

go to em first, right click on soa-infra, drill into service-engines and Human Workflow. 

snap040.jpg


click the HumanTask and then,


snap041.jpg


change the URI to point the page u made before. 
Good Luck!

[Read More]

HWF in 11g

I recognize that there are few changes made from 10g Worklist API to 11g. I've tried figuring out how I can use it in 11g just like old days, and finally got my sample code working successfully. here I'll describe the basic things to use HWF in 11g.

in 10g, we have to have wf_client_config.xml in classpath to set the soap endpoints and ejb lookup properties which is used by worklist client. in 11g, you have two choices. just like old days, you can have wf_client_config.xml, or you can hand properties to Factory which precede the configuration file.

Speaking about Properties, we're using oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants to set the connection properties. look at the simple example below:


Map
properties = new
HashMap();

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.MODE, IWorkflowServiceClientConstants.MODE_DYNAMIC);

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:8001");

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "welcome1");

properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "weblogic");

IWorkflowServiceClient wfSvcClient =
WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT,
properties, null);

IWorkflowContext ctx = null;
ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();


and configuration file, u can use the sample as below:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<workflowServicesClientConfiguration xmlns="http://xmlns.oracle.com/bpel/services/client">

  <server name="default" default="true">

    <localClient>

        <participateInClientTransaction>false</participateInClientTransaction>

    </localClient>

    <remoteClient>

         <serverURL>t3://localhost:7001</serverURL>

    <userName>weblogic</userName>

         <password>weblogic</password>

         <initialContextFactory>weblogic.jndi.WLInitialContextFactory</initialContextFactory>

         <participateInClientTransaction>false</participateInClientTransaction>

    </remoteClient>

    <soapClient>

        <rootEndPointURL>http://localhost:7001</rootEndPointURL>

        <identityPropagation mode="dynamic" type="saml">

            <policy-references>

                <policy-reference enabled="true" category="security" uri="oracle/wss10_saml_token_client_policy"/>

            </policy-references>

        </identityPropagation>

    </soapClient>

  </server>  

</workflowServicesClientConfiguration>

store it as wf_client_config.xml and put it under the classpath.

I've tried SOAP_CLIENT with no success yet. once I find the answer, I'll share this,too.

[Read More]

Monday Aug 17, 2009

Mediator JavaCallout Sample

Here is the sample code for the Mediator JavaCallout. be cautious that
if there is an Runtime Exception raised inside your Callout class, your composite
never get invoked.

sample code:

public class CalloutTest extends AbstractJavaCalloutImpl {
public CalloutTest() {
}

public void initialize(Logger logger) throws MediatorCalloutException {
}


public boolean preRouting(CalloutMediatorMessage message) throws MediatorCalloutException {

System.out.println("Pre routing...");
return false;
}

public boolean postRouting(CalloutMediatorMessage message,
CalloutMediatorMessage response,
Throwable e) throws MediatorCalloutException {
System.out.println("Start Post routing...");
return true;
}

public boolean preRoutingRule(CaseType caseType,
CalloutMediatorMessage externalMediatorMessage) throws MediatorCalloutException {
System.out.println("Start PreRoutingRule.");
HashMap payload = (HashMap)externalMediatorMessage.getPayload();
Element payloadNode = (Element)payload.get("request");

return true;
}

public boolean postRoutingRule(CaseType caseType,
CalloutMediatorMessage externalMediatorMessage,
CalloutMediatorMessage externalMediatorMessage1,
Throwable throwable) throws MediatorCalloutException {
System.out.println("Start PostRoutingRule.");

HashMap payload = (HashMap)externalMediatorMessage.getPayload();
Element payloadNode = (Element)payload.get("request");
return true;
}
}

About

Solution & Technology Architect, Asia Pacific

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today