jueves, 18 de diciembre de 2008

How I managed to run a standalone Oracle SOA Suite Worklist basic client

Escenary:
  • Standalone command line remote client.
  • No IDE.
  • Basic client funcion: print all tasks for a hard-coded user.
  • Based on "Invoking BPEL Worklist API from Remote Server with Java [Amis blog]" and buddy's help.
  • I ran it on Java 1.4. It's not working on Java 5 for me. Java says: "java.lang.SecurityException: class "com.collaxa.cube.ExceptionIndex"'s signer information does not match signer information of other classes in the same package". But works also on Java 6. Ups.

"Project" layout:



"lib" directory:


"config" directory:


"schema" directory:


"src" directory:


"compile" file content:
set LIBDIR="lib"
set CLASSESDIR="classes"
set CP="%LIBDIR%\bpm-infra.jar;%LIBDIR%\orabpel-common.jar;%LIBDIR%\orabpel-thirdparty.jar;%LIBDIR%\orabpel.jar;%LIBDIR%\orasaaj.jar;%LIBDIR%\config;%LIBDIR%\bpm-services.jar;%LIBDIR%\schema;%LIBDIR%\wsclient_extended.jar;%CLASSESDIR%"
set JAVA_HOME="C:\java\j2sdk1.4.2_16"

%JAVA_HOME%\bin\javac.exe -classpath %CP% -d %CLASSESDIR% %1%

"run" file content:
set LIBDIR="lib"
set CLASSESDIR="classes"
set CP="%LIBDIR%\bpm-infra.jar;%LIBDIR%\orabpel-common.jar;%LIBDIR%\orabpel-thirdparty.jar;%LIBDIR%\orabpel.jar;%LIBDIR%\orasaaj.jar;%LIBDIR%\config;%LIBDIR%\bpm-services.jar;%LIBDIR%\schema;%LIBDIR%\wsclient_extended.jar;%CLASSESDIR%"
set JAVA_HOME="C:\java\j2sdk1.4.2_16"

%JAVA_HOME%\bin\java.exe -cp %CP% test.WorklistTest


"WorklistTest.java" file content:
package test;

import java.util.ArrayList;
import java.util.List;

import oracle.bpel.services.workflow.IWorkflowConstants;
import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;
import oracle.bpel.services.workflow.query.ITaskQueryService;
import oracle.bpel.services.workflow.repos.Predicate;
import oracle.bpel.services.workflow.repos.TableConstants;
import oracle.bpel.services.workflow.task.model.Task;
import oracle.bpel.services.workflow.verification.IWorkflowContext;

public class WorklistTest {

private static final String USER = "user";
private static final String PASSWORD = "password";
private static final String REALM = "jazn.com";

public static void main(String[] args)
{
try
{

IWorkflowServiceClient client;
IWorkflowContext workflowContext;
ITaskQueryService taskQueryService;

client = WorkflowServiceClientFactory.getWorkflowServiceClient(
WorkflowServiceClientFactory.SOAP_CLIENT);
taskQueryService = client.getTaskQueryService();
workflowContext = taskQueryService.authenticate(
USER, PASSWORD, REALM, null);

Predicate whereclause = new Predicate(
TableConstants.WFTASK_STATE_COLUMN, Predicate.OP_EQ,
IWorkflowConstants.TASK_STATE_ASSIGNED);

List displayColumns = new ArrayList();
displayColumns.add("CREATEDDATE");
displayColumns.add("TITLE");
displayColumns.add("IDENTIFICATIONKEY");
List optionalInfo = new ArrayList();

List tasks = taskQueryService.queryTasks(
workflowContext, displayColumns, optionalInfo,
"My+Group", null, whereclause, null, 0, 0);

if (tasks != null) {
String[] taskList = new String[tasks.size()];
for (int i = 0; i < tasks.size(); i++) {
Task t = (Task)tasks.get(i);
taskList[i] = t.getSystemAttributes().getTaskId();
System.out.println("Task " + i + ": " + taskList[i]);
}
} else {
System.out.println("Did not find any tasks");
}

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

}

"wf_client_config.xml" file content:
<servicesClientConfigurations xmlns="http://xmlns.oracle.com/bpel/services/client">

<ejb>
<!-- <serverURL>opmn:ormi://[server]:[opmn_port]:[oc4j_soa_instance]/hw_services</serverURL> --> <!-- for stand alone -->
<serverURL>opmn:ormi://[server]/hw_services</serverURL> <!-- for opmn managed instance -->
<user>oc4jadmin</user>
<password>password</password>
<initialContextFactory>oracle.j2ee.rmi.RMIInitialContextFactory</initialContextFactory>
</ejb>

<identityService>
<soapEndPoint>http://[server]:7777/integration/services/IdentityService/identity</soapEndPoint>
</identityService>

<identityConfigService>
<soapEndPoint>http://[server]:7777/integration/services/IdentityService/configuration</soapEndPoint>
</identityConfigService>

<taskService>
<soapEndPoint>http://[server]:7777/integration/services/TaskService/TaskServicePort</soapEndPoint>
</taskService>

<taskMetadataService>
<soapEndPoint>http://[server]:7777/integration/services/TaskMetadataService/TaskMetadataServicePort</soapEndPoint>
</taskMetadataService>

<taskQueryService>
<soapEndPoint>http://[server]:7777/integration/services/TaskQueryService/TaskQueryService</soapEndPoint>
</taskQueryService>

<userMetadataService>
<soapEndPoint>http://[server]:7777/integration/services/UserMetadataService/UserMetadataService</soapEndPoint>
</userMetadataService>

<runtimeConfigService>
<soapEndPoint>http://[server]:7777/integration/services/RuntimeConfigService/RuntimeConfigService</soapEndPoint>
</runtimeConfigService>

<!-- specifies the mapping for portal realm to is_config realm -->
<portal>
<realmMapping>jazn.com</realmMapping>
</portal>

</servicesClientConfigurations>

"wf_config.xml" file content:
<workflowConfigurations
xmlns="http://xmlns.oracle.com/pcbpel/humanworkflow/configurations"
xmlns:user="http://xmlns.oracle.com/bpel/workflow/userMetadata">

<taskAutoReleaseConfigurations>
<taskAutoRelease priority="1" default="P1D" percentageOfExpiration="30"/>
<taskAutoRelease priority="2" default="P2D" percentageOfExpiration="40"/>
<taskAutoRelease priority="3" default="P3D" percentageOfExpiration="50"/>
<taskAutoRelease priority="4" default="P4D" percentageOfExpiration="60"/>
<taskAutoRelease priority="5" default="P5D" percentageOfExpiration="70"/>
</taskAutoReleaseConfigurations>

<worklistApplicationURL>http://[server]:7777/integration/worklistapp/TaskDetails?taskId=PC_HW_TASK_ID_TAG</worklistApplicationURL>

<actionableEmailAccountName/>

<pushbackAssignee>INITIAL_ASSIGNEES</pushbackAssignee>

<assigneeDelimiter><![CDATA[,]]></assigneeDelimiter>

<shortHistoryActions>
<action>ACQUIRE</action>
<action>INFO_REQUEST</action>
<action>INFO_SUBMIT</action>
<action>RELEASE</action>
</shortHistoryActions>

<workflowServiceSessionTimeoutInMinutes>60</workflowServiceSessionTimeoutInMinutes>

<user:ruleRepositoryInfo>
<user:ruleEngine>ORACLE</user:ruleEngine>
<user:repositoryLocation>WFRepository</user:repositoryLocation>
<user:dictionaryName>WFDictionary</user:dictionaryName>
<user:reposProperty name="reposType">jar</user:reposProperty>
</user:ruleRepositoryInfo>

<property name="worklist.redirectpage" value="TaskDetails" />
<property name="worklist.loginpage" value="Login.jsp" />
<property name="worklist.errorpage" value="Error.jsp" />

</workflowConfigurations>

1 comentario:

Sanu dijo...

Hola! tengo una consulta que es "My+Group" es alguna palabra reservada o el dominio de bpel que es? gracias =)

# List tasks = taskQueryService.queryTasks(
# workflowContext, displayColumns, optionalInfo,
# "My+Group", null, whereclause, null, 0, 0);