AnsweredAssumed Answered

Activiti CXF JacksonJsonProvider

Question asked by mwm1 on Jul 6, 2015
Latest reply on Jul 6, 2015 by mwm1
Hi,
Using CXF, I would like to invoke <php> http://localhost:8080/activiti-rest/service/runtime/process-instances </php>
The test below fall:


import org.apache.cxf.jaxrs.client.WebClient;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestInvoke {

   private ApplicationContext context;

   @Test
   public void test() throws Exception {

      context = new ClassPathXmlApplicationContext("spring-cxf.config.xml");
      WebClient client = context.getBean("rsWebClient", WebClient.class);

      assertNotNull(WebClient.fromClient(client)
            .header("Authorization", setUser()).accept("application/json")
            .type("application/json").path("/service").path("/runtime")
            .path("/process-instances").get());

   }

   private String setUser() {
      String username = "kermit";
      String password = "kermit";

      return "Basic "
            + org.apache.cxf.common.util.Base64Utility.encode((username
                  + ":" + password).getBytes());

   }

}


My question is : how I can parse the result of <php> http://localhost:8080/activiti-rest/service/runtime/process-instances </php>
May I have to create a class "Message" (as below) referenced in the cxf config file as <php>  <context:component-scan base-package="com.test.runtime.process" /> </php>


public class Message{
Collection data;
    private String id;
       private String url;
       private String  businessKey;
       private boolean suspended;
       private boolean ended;
       private String processDefinitionId;
       private String processDefinitionUrl;
       private String activityId;
       private String tenantId;
       private boolean completed;
}

Outcomes