Skip to content

Instantly share code, notes, and snippets.

@biemond
Created October 16, 2011 18:16
BPM SOA humanworkflow connection
private String wlsserver = "HumanWorkFlow";
private String soaserver = null;
private String wsurl = null;
private String t3url = null;
private String contextFactory = "weblogic.jndi.WLInitialContextFactory";
private String identityDomain = "jazn.com";
private String identityUsername = null;
private String identityPassword = null;
private IWorkflowContext context = null;
private IWorkflowServiceClient workflowServiceClient;
private BPMIdentityService bpmClient;
/**
* Constructor.
*/
public BPELWorkflowServices() {
// Retrieve Workflow service client
logger.info("[START] BPELWorkflowServices");
Properties defaultProps = new Properties();
InputStream in;
try {
logger.info("load soa.properties");
in = this.getClass().getResourceAsStream ("/soa.properties");
defaultProps.load(in);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
if ( defaultProps.containsKey("soaserver") ){
logger.info("found soaserver: " + defaultProps.getProperty("soaserver"));
soaserver = defaultProps.getProperty("soaserver");
} else {
logger.info("try to find -Dhumantask.url");
soaserver = System.getProperty("humantask.url");
}
wsurl = "http://" + soaserver;
t3url = "t3://" + soaserver;
if ( defaultProps.containsKey("humantask.user") ){
logger.info("found user: " + defaultProps.getProperty("humantask.user"));
identityUsername = defaultProps.getProperty("humantask.user");
} else {
identityUsername = System.getProperty("humantask.user");
}
if ( defaultProps.containsKey("humantask.password") ){
logger.info("found password: " + defaultProps.getProperty("humantask.password"));
identityPassword = defaultProps.getProperty("humantask.password");
} else {
identityPassword = System.getProperty("humantask.password");
}
try {
WorkflowServicesClientConfigurationType wscct =
new WorkflowServicesClientConfigurationType();
List<ServerType> servers = wscct.getServer();
ServerType server = new ServerType();
server.setDefault(true);
server.setName(wlsserver);
servers.add(server);
RemoteClientType rct = new RemoteClientType();
rct.setServerURL(t3url);
rct.setInitialContextFactory(contextFactory);
rct.setParticipateInClientTransaction(false);
server.setRemoteClient(rct);
workflowServiceClient =
WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT,
wscct,
logger2);
Map<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, java.lang.String> properties =
new HashMap<IWorkflowServiceClientConstants.CONNECTION_PROPERTY, java.lang.String>();
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.SOAP_END_POINT_ROOT,
wsurl);
bpmClient =
WorkflowServiceClientFactory.getSOAPIdentityServiceClient(identityDomain,
properties,
logger2);
} catch (Exception e) {
//Handle any exceptions raised here...
logger.error("Caught workflow exception: " + e.getMessage());
}
}
private ITaskQueryService getTaskQueryService() {
return workflowServiceClient.getTaskQueryService();
}
private ITaskService getTaskService() {
return workflowServiceClient.getTaskService();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment