03-26-2018 02:23 AM
I have created a Process for Alfresco Process Service and now I want to trigger it from Alfresco Content Service when, an E-mail comes to Alfresco Content Service, how it's possible?
03-30-2018 04:22 PM
And can you provide more details to your error, i.e. the original exception stacktrace / response?
03-30-2018 04:32 PM
It shows: package(com.activiti.alfresco.service) does not exist, which I have used in my package.
03-31-2018 07:28 AM
Don't use it then. It sounds like a package that would only be available within APS itself, but now your are writing code inside ACS.
04-02-2018 03:11 AM
Could you please provide me some guidance or some example, like how I supposed to do this in ACS?
04-02-2018 03:10 PM
I haven't accessed APS from ACS myself, so don't have any ready-to-use code samples. But just use any Java-based tooling for doing REST calls and use the APS ReST API. Don't rely on any APS-internal APIs which are not available in ACS. Build your own little REST client abstraction, i.e. backed by libraries like resteasy, jackson or any other in that domain.
04-03-2018 10:06 AM
Hi again,
now I am trying to start the process by the following code but getting: Caused by: java.lang.RuntimeException: Failed : HTTP error code : 401
private Behaviour onCreateNode;
public void init() {
this.onCreateNode = new JavaBehaviour(this, "onCreateNode", NotificationFrequency.TRANSACTION_COMMIT);
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), ContentModel.TYPE_CONTENT, this.onCreateNode);
}
@Override
public void onCreateNode(ChildAssociationRef childasso) {
NodeRef node=childasso.getChildRef();
System.out.println(node);
System.out.println(childasso.getQName());
try {
URL url = new URL("localhost:9090/activiti-app/api/enterprise/process-instances");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Accept", "application/json");
String input = "{\"processDefinitionId\":\"adhoctask:1:13\"}";
OutputStream os = conn.getOutputStream();
os.write(input.getBytes());
os.flush();
if (conn.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
}catch (MalformedURLException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
could you please correct me?
04-04-2018 05:29 AM
Could you please provide the real error? I.e. look into alfresco.log for the details, because the screenshot only shows a wrapped message...
04-04-2018 08:26 AM
Actually, I am getting two errors in the log while compiling, which are in the following screenshot.
04-05-2018 02:59 AM
So there you have it - you are throwing that error yourself because you get a 401 response code... Your custom code isn't handling authentication.
04-06-2018 02:14 AM
So could you please pointer me where should I suppose to change in my code to trigger the process?
Explore our Alfresco products with the links below. Use labels to filter content by product module.