01-30-2013 06:56 AM
package com.morex.test;
import javax.ejb.Stateless;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
@Stateless
@WebService
public class AddressService {
@WebResult(name="findCustomerAddressResponseItem")
public String findCustomerAddress(@WebParam(name="findCustomerAddressRequestItem") String customerName) {
System.out.println("——————————————————- ");
System.out.println("| | ");
System.out.println("| | ");
System.out.println("| | ");
System.out.println("| | ");
System.out.println("| customerName = "+ customerName);
System.out.println("| | ");
System.out.println("| | ");
System.out.println("| | ");
System.out.println("| | ");
System.out.println("——————————————————- ");
return "Customer [ "+ customerName + " ] has address ABC…" ;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" targetNamespace="com.morex.test.AddressService"
xmlns:tns="com.morex.test.AddressService" xmlns:classObject="http://test.morex.com/">
<import importType="http://schemas.xmlsoap.org/wsdl/"
location="http://192.168.7.166:8381/CreateWS-1/AddressService?wsdl"
namespace="http://test.morex.com/" />
<message id="findCustomerAddressRequestMessage" itemRef="tns:findCustomerAddressRequestItem" />
<message id="findCustomerAddressResponseMessage" itemRef="tns:findCustomerAddressResponseItem" />
<itemDefinition id="findCustomerAddressRequestItem" structureRef="classObject:findCustomerAddress" />
<itemDefinition id="findCustomerAddressResponseItem" structureRef="classObject:findCustomerAddressResponse" />
<interface name="Find customer address" implementationRef="classObject:AddressService">
<operation id="findCustomerAddressOperation" name="Find Customer Address by name" implementationRef="classObject:findCustomerAddress">
<inMessageRef>tns:findCustomerAddressRequestMessage</inMessageRef>
<outMessageRef>tns:findCustomerAddressResponseMessage</outMessageRef>
</operation>
</interface>
<process id="call_wsdl">
<dataObject id="dataInputOfProcess" itemSubjectRef="tns:findCustomerAddressRequestItem" />
<dataObject id="dataOutputOfProcess" itemSubjectRef="tns:findCustomerAddressResponseItem" />
<startEvent id="startevent" name="Start" />
<sequenceFlow id="flow1" sourceRef="startevent" targetRef="theScriptTask" />
<scriptTask id="theScriptTask" scriptFormat="groovy" name="Execute script">
<script>
System.out.println("dataInputOfProcess : "+dataInputOfProcess);
System.out.println("dataOutputOfProcess : "+dataOutputOfProcess);
</script>
</scriptTask>
<sequenceFlow id="flow1a" sourceRef="theScriptTask" targetRef="webService" />
<serviceTask id="webService" name="Find customer address web service" implementation="##WebService" operationRef="tns:findCustomerAddressOperation">
<ioSpecification>
<dataInput itemSubjectRef="tns:findCustomerAddressRequestItem" isCollection="false" id="requestItem" />
<dataOutput itemSubjectRef="tns:findCustomerAddressResponseItem" isCollection="false" id="responsetItem" />
<inputSet>
<dataInputRefs>requestItem</dataInputRefs>
</inputSet>
<outputSet>
<dataOutputRefs>responsetItem</dataOutputRefs>
</outputSet>
</ioSpecification>
<dataInputAssociation>
<sourceRef>dataInputOfProcess</sourceRef>
<targetRef>requestItem</targetRef>
</dataInputAssociation>
<dataOutputAssociation>
<targetRef>dataOutputOfProcess</targetRef>
<transformation>${responsetItem}</transformation>
</dataOutputAssociation>
</serviceTask>
<sequenceFlow id="flow21" sourceRef="webService" targetRef="theScriptTask2" />
<scriptTask id="theScriptTask2" scriptFormat="groovy" name="Execute script 2">
<script>
System.out.println("dataInputOfProcess : "+dataInputOfProcess);
System.out.println("dataOutputOfProcess : "+dataOutputOfProcess);
</script>
</scriptTask>
<sequenceFlow id="flow2" sourceRef="theScriptTask2" targetRef="endevent" />
<endEvent id="endevent" name="End" />
</process>
</definitions>
package com.bpmn.test;
import java.util.HashMap;
import java.util.Map;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
public class ProcessRunner {
public static void main(String[] args) {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment() .addClasspathResource("call_WSDL.bpmn20.xml") .deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("dataInputOfProcess", "morex");
variables.put("dataOutputOfProcess", "x");
runtimeService.startProcessInstanceByKey("call_wsdl",variables);
}
}
01:23:55,332 INFO [STDOUT] ——————————————————-
01:23:55,333 INFO [STDOUT] | |
01:23:55,333 INFO [STDOUT] | |
01:23:55,333 INFO [STDOUT] | |
01:23:55,333 INFO [STDOUT] | |
01:23:55,333 INFO [STDOUT] | customerName = morex
01:23:55,334 INFO [STDOUT] | |
01:23:55,334 INFO [STDOUT] | |
01:23:55,334 INFO [STDOUT] | |
01:23:55,334 INFO [STDOUT] | |
01:23:55,334 INFO [STDOUT] ——————————————————-
Jan 30, 2013 3:17:38 PM org.activiti.engine.ProcessEngines init
INFO: Initializing process engine using configuration 'file:/F:/morteza-pooladi-share/JAVA/workspace/Test21/target/classes/activiti.cfg.xml'
Jan 30, 2013 3:17:38 PM org.activiti.engine.ProcessEngines initProcessEnginFromResource
INFO: initializing process engine for resource file:/F:/morteza-pooladi-share/JAVA/workspace/Test21/target/classes/activiti.cfg.xml
Jan 30, 2013 3:17:38 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from resource loaded through InputStream
Jan 30, 2013 3:17:39 PM org.activiti.engine.impl.ProcessEngineImpl <init>
INFO: ProcessEngine default created
Jan 30, 2013 3:17:39 PM org.activiti.engine.ProcessEngines initProcessEnginFromResource
INFO: initialised process engine default
Jan 30, 2013 3:17:39 PM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource call_WSDL.bpmn20.xml
Jan 30, 2013 3:17:39 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XMLSchema currently not supported as typeLanguage
Jan 30, 2013 3:17:39 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XPath currently not supported as expressionLanguage
Jan 30, 2013 3:17:40 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseProcessDefinitions
INFO: Process with id='call_wsdl' has no attribute isExecutable. Assuming it is executable. Better set the attribute explicitely, especially to be compatible with future engine versions which might change the default behavior.
dataInputOfProcess : morex
dataOutputOfProcess : x
Jan 30, 2013 3:17:41 PM org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames
INFO: Created classes: com.morex.test.FindCustomerAddress, com.morex.test.FindCustomerAddressResponse, com.morex.test.ObjectFactory
dataInputOfProcess : morex
dataOutputOfProcess : org.activiti.engine.impl.bpmn.data.ItemInstance@260829
01-30-2013 07:19 AM
01-30-2013 07:29 AM
First, read the process-variable using the runtime-service. Next, you can use the getStructureInstance() on the InstanceItem to read the fields that are present in the data, this is either a "FieldBaseStructureInstance" (containing hash maps with field/values) or PrimitiveStructureInstance (which contains only ONE field, a single primitive type).
Jan 30, 2013 3:44:44 PM org.activiti.engine.ProcessEngines init
INFO: Initializing process engine using configuration 'file:/F:/morteza-pooladi-share/JAVA/workspace/Test21/target/classes/activiti.cfg.xml'
Jan 30, 2013 3:44:44 PM org.activiti.engine.ProcessEngines initProcessEnginFromResource
INFO: initializing process engine for resource file:/F:/morteza-pooladi-share/JAVA/workspace/Test21/target/classes/activiti.cfg.xml
Jan 30, 2013 3:44:44 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from resource loaded through InputStream
Jan 30, 2013 3:44:45 PM org.activiti.engine.impl.ProcessEngineImpl <init>
INFO: ProcessEngine default created
Jan 30, 2013 3:44:45 PM org.activiti.engine.ProcessEngines initProcessEnginFromResource
INFO: initialised process engine default
Jan 30, 2013 3:44:45 PM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource call_WSDL.bpmn20.xml
Jan 30, 2013 3:44:45 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XMLSchema currently not supported as typeLanguage
Jan 30, 2013 3:44:45 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XPath currently not supported as expressionLanguage
Jan 30, 2013 3:44:46 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseProcessDefinitions
INFO: Process with id='call_wsdl' has no attribute isExecutable. Assuming it is executable. Better set the attribute explicitely, especially to be compatible with future engine versions which might change the default behavior.
dataInputOfProcess : morex
dataOutputOfProcess : x
Jan 30, 2013 3:44:46 PM org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames
INFO: Created classes: com.morex.test.FindCustomerAddress, com.morex.test.FindCustomerAddressResponse, com.morex.test.ObjectFactory
dataInputOfProcess : morex
dataOutputOfProcess : org.activiti.engine.impl.bpmn.data.ItemInstance@d622e5
Jan 30, 2013 3:44:48 PM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: execution 24604 doesn't exist
at org.activiti.engine.impl.cmd.GetExecutionVariableCmd.execute(GetExecutionVariableCmd.java:52)
at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:60)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(RuntimeServiceImpl.java:115)
at com.bpmn.test.ProcessRunner.main(ProcessRunner.java:30)
Exception in thread "main" org.activiti.engine.ActivitiException: execution 24604 doesn't exist
at org.activiti.engine.impl.cmd.GetExecutionVariableCmd.execute(GetExecutionVariableCmd.java:52)
at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:60)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(RuntimeServiceImpl.java:115)
at com.bpmn.test.ProcessRunner.main(ProcessRunner.java:30)
01-30-2013 07:49 AM
01-30-2013 09:14 AM
<scriptTask id="theScriptTask2" scriptFormat="groovy" name="Execute script 2">
<script>
String responceItemName = dataOutputOfProcess.structureInstance.getFieldNameAt(0);
System.out.println("responce Item Name : " + responceItemName);
System.out.println("dataOutputOfProcess : "+dataOutputOfProcess.structureInstance.getFieldValue(responceItemName));
</script>
</scriptTask>
…
…
Jan 30, 2013 5:42:08 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XPath currently not supported as expressionLanguage
Jan 30, 2013 5:42:09 PM org.activiti.engine.impl.bpmn.parser.BpmnParse parseProcessDefinitions
INFO: Process with id='call_wsdl' has no attribute isExecutable. Assuming it is executable. Better set the attribute explicitely, especially to be compatible with future engine versions which might change the default behavior.
dataInputOfProcess : morex
dataOutputOfProcess : x
Jan 30, 2013 5:42:10 PM org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames
INFO: Created classes: com.morex.test.FindCustomerAddress, com.morex.test.FindCustomerAddressResponse, com.morex.test.ObjectFactory
responce Item Name : responseItem
dataOutputOfProcess : Customer [ morex ] has address ABC…
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.