Hi there,
as briefly mentioned on IRC channel I would like to share some thoughts
about web service support for service task. First of all motivation to
add this feature is to be compliant with BPMN2 spec (in my opinion one
of the main constructs) and its default implementation technology.
Currently the default service task handler allows to execute java class
based on defined interface and operation that maps to the class name and
its method.
I would like to extend it to be able to support following scenarios:
- if implementation attribute of the service task is set to ##other will
use the current support to execute java method in the defined class
- if implementation attribute of the service task is set to ##WebService
will utilize dynamic client of apache cxf to make a call
In both cases interface and its operations need to be defined and in
case of web service some additional steps needs to be taken:
1. import wsdl into bpmn2 file
2. make use of implementationRef attribute of the interface to point out
the port type of the service from imported wsdl
3. make use of implementationRef attribute of the operation to specify
operation declared in the wsdl
Simplified bpmn2 that declares web service service task will look like this:
<bpmn2:definitions>
<bpmn2:import
importType="http://schemas.xmlsoap.org/wsdl/"
location="http://127.0.0.1:9876/HelloService/greeting?wsdl"
namespace="http://objects.bpmn2.jbpm.org/"/>
<!-- import wsdl -->
<bpmn2:itemDefinition id="_2_InMessageType"
structureRef="java.lang.String"/>
<bpmn2:message id="_2_InMessage" itemRef="_2_InMessageType"/>
<!-- declare interface with reference to the port type in wsdl -->
<bpmn2:interface id="_2_ServiceInterface"
implementationRef="SimpleService" name="">
<!-- declare operation with reference to operation in wsdl -->
<bpmn2:operation id="_2_ServiceOperation" implementationRef="hello"
name="hello">
<bpmn2:inMessageRef>_2_InMessage</bpmn2:inMessageRef>
</bpmn2:operation>
</bpmn2:interface>
<bpmn2:process id="WebServiceTask" tns:version="1"
tns:packageName="defaultPackage" name="WebServiceTask">
<bpmn2:startEvent id="StartEvent_1">
</bpmn2:startEvent>
<!-- use implementation ##WebService" for service task -->
<bpmn2:serviceTask id="ServiceTask_1" name="Service Task"
implementation="##WebService" operationRef="_2_ServiceOperation">
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_1" tns:priority="1"
sourceRef="ServiceTask_1" targetRef="EndEvent_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_2" tns:priority="1"
name=""
sourceRef="StartEvent_1" targetRef="ServiceTask_1"/>
<bpmn2:endEvent id="EndEvent_1">
</bpmn2:endEvent>
</bpmn2:process>
</bpmn2:definitions>
Wdyt?
Of course this could be implemented using domain specific service that
will be dedicated to web service invocations but I believe that aligning
it with bpmn2 spec is what users would expect.
Cheers