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?
04-06-2018 03:07 AM
I thought I did: Your custom code needs to handle authentication against APS, i.e. manage login / SSO and session. As I mentioned earler, you should use ReST / HTTP client framework (not use the raw Java URL connection handling), which typically already provide some utilities i.e. for HTTP BASIC authentication and session handling, as well as JSON to Java mapping.
04-06-2018 08:05 AM
as you mentioned I updated my code but after changing I am still facing same errors and I am new to alfresco so I don't know how to manage login/SSO and session through my code against APS. My updated code is below:
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost postRequest = new HttpPost(
"http://23.22.110.20:9090/activiti-app/api/enterprise/process-instances");
StringEntity input = new StringEntity("{\"processDefinitionId\":\"adhoctask:1:13\"}");
input.setContentType("application/json");
postRequest.setEntity(input);
HttpResponse response = httpClient.execute(postRequest);
if (response.getStatusLine().getStatusCode() != 201) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatusLine().getStatusCode());
}
BufferedReader br = new BufferedReader(
new InputStreamReader((response.getEntity().getContent())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
httpClient.getConnectionManager().shutdown();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Could you please address me how to fix those errors?
04-06-2018 09:02 AM
You are still not handling any sort of authentication.... Since you are using HttpClient, I'd advise to look into its documentation on authentication. And also check the APS documentation on handling authorisation.
Explore our Alfresco products with the links below. Use labels to filter content by product module.