Also i tried start proces with this code but nothing happens:
package activiti;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URI;
import java.util.TreeMap;
import org.apache.commons.codec.binary.Base64;
import org.springframework.http.HttpHeaders;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
public class MyUnitTest
{
private static String HOST = "localhost";
private static String PORT = "8080";
private static String PROTOCOL = "http";
public static String BASE_URL = PROTOCOL+"://"+HOST+":"+PORT+"/activiti-rest/";
TreeMap<String, Object> mainParams= new TreeMap<String, Object>();
mainParams.put("processDefinitionKey", "vacReq");
RestTemplate restTemplate = new RestTemplate(getAuthenticatedHeader());
URI uri = restTemplate.postForLocation(BASE_URL+"service/runtime/process-instances", mainParams ,mainParams);
private SimpleClientHttpRequestFactory getAuthenticatedHeader() {
SimpleClientHttpRequestFactory connectionFactory = new SimpleClientHttpRequestFactory() {
@Override
protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
super.prepareConnection(connection, httpMethod);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(org.springframework.http.MediaType.APPLICATION_JSON);
String authorisation = "kermit:kermit";
byte[] encodedAuthorisation = Base64.encodeBase64(authorisation.getBytes());
connection.setRequestProperty("Authorization", "Basic "+new String(encodedAuthorisation));
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "application/json");
}
};
return connectionFactory;
}
}