About Task Form
by Massimiliano Ziccardi
Hi all.
I've searched through the net and through the forum, bat couldn't find the
informations I need (probably it's my fault).
I've designed a flow using the jPDL designer. The flow has some form too
(xhtml).
I've my custom web interface (I don't want to use the jBPM console).
How can I integrate such pages inside my web application? Wich method should
I call to get those pages?
Thanks in advance,
Massimiliano Ziccardi
17 years, 5 months
[JBoss jBPM] - Re: How to invoke rules(drools) from a jBPM
by rinki
Below are the files:
1. File for invoking jbpm process
package com.sample.test;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
public class TestDroolsInvocation {
/**
* @param args
*/
public static void main(String[] args) {
ProcessDefinition definition = ProcessDefinition.parseXmlResource("JbpmDroolsExample/processdefinition.xml");
ProcessInstance instance = new ProcessInstance(definition);
instance.signal();
//instance.signal();
System.out.println("Ended!!!");
}
}
2. File where rules are invoked(Actionhandler)
package com.sample.action;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.DrlParser;
import org.drools.compiler.PackageBuilder;
import org.drools.lang.descr.PackageDescr;
import org.drools.rule.Package;
import java.io.*;
public class FireRulesActionHandler implements ActionHandler {
private static final long serialVersionUID = 1L;
public static String ruleFile;
/**
* The FireRulesActionHandler gets variables from the Instance, and asserts
* them into the Rules Engine and invokes the rules.
*/
public void execute(ExecutionContext executionContext) throws Exception {
try {
//load up the rulebase
RuleBase ruleBase = readRule();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
//go !
Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.LikesCheese );
workingMemory.insert( message );
workingMemory.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
private static RuleBase readRule() throws Exception {
//read in the source
Reader source = new InputStreamReader( FireRulesActionHandler.class.getResourceAsStream("E:/jBPM/workspace/InvokingDrools/src/main/java/com/sample/rules/CheeseRules.drl"));
//Reader source = new InputStreamReader(FireRulesActionHandler.class.getResourceAsStream(ruleFile));
DrlParser parser = new DrlParser();
PackageDescr packageDescr = parser.parse(source);
// pre build the package
PackageBuilder builder = new PackageBuilder();
builder.addPackage(packageDescr);
Package pkg = builder.getPackage();
/*PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( source );
Package pkg = builder.getPackage();*/
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}
public static class Message {
public static final int LikesCheese = 0;
public static final int GOODBYE = 1;
private String message;
private int status;
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public int getStatus() {
return this.status;
}
public void setStatus( int status ) {
this.status = status;
}
}
}
3. CheeseRules.drl
#created on: Nov 4, 2008
package src.main.rules
import com.sample.action.FireRulesActionHandler.Message;
rule "Bob Likes Cheese"
when
m : Message( status == Message.LikesCheese, message : message )
then
System.out.println( message );
m.setMessage( "Bob enjoys eating cheese" );
m.setStatus( Message.GOODBYE );
update( m );
end
rule "GoodBye"
when
Message( status == Message.GOODBYE, message : message )
then
System.out.println( message );
end
Everything is present in jbpm project.
Regards,
Ruchika
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186681#4186681
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186681
17 years, 5 months
[JBoss jBPM] - call/ start bpel process from web application
by sw_bpel
hello,
i have created my own bpel process, deployed it use an ant script and tested it using soap ui. it seems that so far everything works fine.
now i have created an web application in eclipse (dynamic web project) and i want to call/ invoke/ start the bpel process from an servlet inside the web application. therefore i want to create a web service client in eclipse (new -> other -> web services -> web service client). i typed in the address of the bpel process wsdl
configuration:
- server: jboss v4.2
- web service runtime: apache axis
and clicked finish, but then i get the following error:
| IWAB0014E Unexpected exception occurred.
|
| java.lang.NullPointerException
| at org.eclipse.jst.ws.internal.axis.consumption.ui.task.Stub2BeanCommand.execute(Stub2BeanCommand.java:121)
| at org.eclipse.jst.ws.internal.axis.consumption.ui.task.ClientCodeGenOperation$ClientWSModifyOperation.execute(ClientCodeGenOperation.java:110)
| at org.eclipse.jst.ws.internal.axis.consumption.ui.task.ClientCodeGenOperation.execute(ClientCodeGenOperation.java:61)
| at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419)
| at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359)
| at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254)
| at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$6.run(SimpleCommandEngineManager.java:294)
| at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
| at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
| at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)
| at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264)
| at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91)
| at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.performFinish(WizardPageManager.java:262)
| at org.eclipse.wst.command.internal.env.ui.widgets.DynamicWizard.performFinish(DynamicWizard.java:380)
| at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)
| at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
| at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
| at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
| at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
| at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
| at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
| at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
| at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
| at org.eclipse.jface.window.Window.open(Window.java:796)
| at org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:182)
| at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
| at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
| at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
| at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
| at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
| at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
| at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
| at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
| at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
| at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
| at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
| at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
| at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
| at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
| at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
| at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
| at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
| at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
| at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
| at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
| at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
| at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
| at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
|
if i do that procedure with other web services i works fine. can't i access the bpel process that way? what do i have to do, to start the bpel process form the servlet and to get the response of the process and present it in an jsp.
thanks for your help!!!
greetings stefan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186678#4186678
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186678
17 years, 5 months