AnsweredAssumed Answered

starting process through REST API

Question asked by opal on Dec 30, 2010
Latest reply on Aug 8, 2012 by gumba
Hi,

Does anybody know how to start the process through the REST API? I try do that in the following way:

@Test
public void testStartProcess() {
   try {
      DefaultHttpClient dhc = new DefaultHttpClient();
      HttpPost hp = new HttpPost("http://localhost:8080/activiti-explorer/process-instance");
      hp.setEntity(new StringEntity("{\"processDefinitionId\":\"helloworld:1\"}", "UTF-8"));
      HttpResponse hr = dhc.execute(hp);
      System.out.println(IOUtils.toString(hr.getEntity().getContent()));
   } catch (Exception e) {
      e.printStackTrace();
   }
}

But the response I obtain is:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:659)
   org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
   org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
   org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
   org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
   org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
root cause
java.lang.NullPointerException
   org.apache.catalina.util.CharsetMapper.getCharset(CharsetMapper.java:106)
   org.apache.catalina.connector.Response.setLocale(Response.java:852)
   org.apache.catalina.connector.ResponseFacade.setLocale(ResponseFacade.java:323)
   javax.servlet.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:201)
   org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1035)
   org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
   org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
   org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
   org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
   org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
   org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
   org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)

I don't know if I invoke correct webapp (activiti-explorer)? Do I also have to login to activiti before starting the process?

Outcomes