I want to use the remote api to get ksession and get running node, complete the workitem.
my code:
try {
  String url="http://localhost:8080/jbpm-console/";
  RemoteRestRuntimeFactory restSessionFactory = new RemoteRestRuntimeFactory("com.demo:demoPro:1.0", new URL(url), "krisv", "krisv");
  RuntimeEngine engine = restSessionFactory.newRuntimeEngine();
  KieSession ksession = engine.getKieSession();
  ProcessInstance processInstance=ksession.getProcessInstance(101);
  WorkflowProcessInstance workflowProcessInstance = ((WorkflowProcessInstance)processInstance);
  Collection<NodeInstance> nodeInstances= workflowProcessInstance.getNodeInstances();
  Iterator<NodeInstance> ite=nodeInstances.iterator();
  while (ite.hasNext()) {
  NodeInstance nodeInstance=(NodeInstance)ite.next();
  String nodeType=nodeInstance.getNode().getClass().getSimpleName();
  System.out.println(nodeType);
  if("WorkItemNode".equals(nodeType)){
      WorkItemNodeInstance workItemNodeInstance=(WorkItemNodeInstance)nodeInstance;
      ksession.getWorkItemManager().completeWorkItem(workItemNodeInstance.getWorkItemId(), null);
  }
  }
  } catch (Exception e) {
  e.printStackTrace();
  }
when execution error:
java.lang.ClassCastException: org.kie.services.client.serialization.jaxb.impl.process.JaxbProcessInstanceResponse cannot be cast to org.kie.api.runtime.process.WorkflowProcessInstance
How complete workitem under jbpm6.0.1 with java remote api ?