try {
AuthenticationUtils.startSession("admin", "admin");
// WebServiceFactory.setEndpointAddress("http://localhost:8080/alfresco/api");
Store storeReference = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
Reference reference = new Reference(storeReference, null, null);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("workflowName", "jbpm$wf:adhoc");
parameters.put("bpm:workflowDescription", "Something");
parameters.put("bpm:assignee", "admin");
parameters.put("bpm:workflowPriority", "1");
ActionUtils.executeAction(reference, "start-workflow", parameters);
AuthenticationUtils.endSession();
} catch (Exception e) {
e.printStackTrace();
}
org.alfresco.webservice.util.WebServiceException: Unable to execute action
at org.alfresco.webservice.util.ActionUtils.executeAction(ActionUtils.java:99)
at it.abd.webdesktop.server.TaskServiceImpl.addWorkflow(TaskServiceImpl.java:436)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:104)
at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:90)
at org.alfresco.webservice.action.ActionFault.getDeserializer(ActionFault.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
at org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
at org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at org.alfresco.webservice.action.ActionServiceSoapBindingStub.executeActions(ActionServiceSoapBindingStub.java:964)
at org.alfresco.webservice.util.ActionUtils.executeAction(ActionUtils.java:84)
… 28 more
WorkflowService workflowService = null;
Date date = new Date();
NodeRef wfPackage = workflowService.createPackage(null);
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(WorkflowModel.PROP_TASK_ID, 3);
properties.put(WorkflowModel.PROP_DUE_DATE, new Date());
properties.put(WorkflowModel.PROP_PRIORITY, 1); // task instance field
properties.put(WorkflowModel.PROP_PERCENT_COMPLETE, 10);
properties.put(WorkflowModel.PROP_START_DATE, date.getTime());
properties.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, "Something");
workflowService.createPackage(wfPackage);
WorkflowDefinition wfDefinition = workflowService.getDefinitionByName(WorkflowModelModeratedInvitation.WORKFLOW_DEFINITION_NAME);
WorkflowPath wfPath = workflowService.startWorkflow(wfDefinition.getId(), properties);
Store storeReference = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
Reference reference = new Reference(storeReference, null, null);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("workflowName", "jbpm$wf:adhoc");
parameters.put("bpm:workflowDescription", "Something");
parameters.put("bpm:assignee", "admin");
parameters.put("bpm:workflowPriority", "1");
ActionUtils.executeAction(reference, "start-workflow", parameters);
parameters.put("bpm:assignee", "admin");
Credo che sia necessario passare il node reference dello user e non la stringa dello username.Credo che l'errore sia in questa linea di codice:Credo che sia necessario passare il node reference dello user e non la stringa dello username.parameters.put("bpm:assignee", "admin");
Quindi credo che tu debba pescare dal repository il node reference che afferisce allo user e poi passarlo come parametro.
Spero di essere stato chiaro :?
<!– –>
<!– Single Task Assignee –>
<!– –>
<aspect name="bpm:assignee">
<associations>
<association name="bpm:assignee">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:person</class>
<mandatory>true</mandatory>
<many>false</many>
</target>
</association>
</associations>
</aspect>
<!– –>
<!– Multiple Task Assignees –>
<!– –>
<aspect name="bpm:assignees">
<associations>
<association name="bpm:assignees">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:person</class>
<mandatory>true</mandatory>
<many>true</many>
</target>
</association>
</associations>
</aspect>
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(QName.createQName("bpm","assignee"), "tuser1");
properties.put(QName.createQName("bpm","description"),"something");
workflowService.startWorkflow("jbpm$wf:adhoc",properties);
Credo che l'errore sia in questa linea di codice:Credo che sia necessario passare il node reference dello user e non la stringa dello username.parameters.put("bpm:assignee", "admin");
Quindi credo che tu debba pescare dal repository il node reference che afferisce allo user e poi passarlo come parametro.
Spero di essere stato chiaro :?
Si, sono d'accordo ma riguardando su Alfresco Developer Guide all'assegnatario viene passata una stringa:Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(QName.createQName("bpm","assignee"), "tuser1");
properties.put(QName.createQName("bpm","description"),"something");
workflowService.startWorkflow("jbpm$wf:adhoc",properties);
Questo codice non può essere utilizzato in un'applicazione esterna basata sui servizi web: workflowService non è esposto come SOAP.Ok, ho capito.
Archive content from product discussions in Italian.
This group is now closed and content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.