APIs, SDKs, and Services > Administration API > Sample Java Client
  

Sample Java Client

Included in the SDK is a Java client sample that demonstrates how to return a list of active processes using a process filter. The source code can be found in the AdminSDK project src-examples package. After you import this project into Process Developer, you can run it as-is or modify the process filters to see how they impact the list of processes returned.
To run the application simply right-click on the JAXWSClient.java file and select the Run As > Java Application command from the menu.
Note: If you don't have the Project | Build Automatically option set, you will need to build this project before running it or after making changes to the source code.
/////////////////////////////////////////////////////////////////////////////
// Copyright 2009 Active Endpoints, Inc
//
// Licensed under the terms of the Active Endpoints, Inc License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.activevos.com/activevos-evaluation-eula.php
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/////////////////////////////////////////////////////////////////////////////
import javax.xml.ws.WebServiceRef;
import javax.xml.namespace.QName;
import example.*;
public class JAXWSClient {
@WebServiceRef(wsdlLocation="http://localhost:8080/active-bpel/services/
ActiveBpelAdmin?wsdl")
static ActiveBpelAdmin service = new ActiveBpelAdmin();
public static void main(String[] args) {
try {
JAXWSClient client = new JAXWSClient();
client.doTest(args);
} catch(Exception e) {
e.printStackTrace();
}
}
public void doTest(String[] args) {
try {
System.out.println("Retrieving the port from the following service: " + service);

IAeAxisActiveBpelAdmin port = service.getActiveBpelAdmin();
System.out.println("Invoking the getProcessList() operation on the port.");
AesProcessFilterType aesPFT = new AesProcessFilterType();
AesProcessFilter aesPF = new AesProcessFilter();

// examples for setting process filters here:
// aesPF.setProcessState(1);
// QName processName = new QName("TerminateRunningProcesses",
// "TerminateRunningProcesses");
// aesPF.setProcessName(processName);
aesPF.setAdvancedQuery("getProcessProperty(\"State\")='3'");
System.out.println("aesPF: " + aesPF.getAdvancedQuery());

aesPFT.setFilter(aesPF);
AesProcessListType response = port.getProcessList(aesPFT);
System.out.println("Total Rows: " +
response.getResponse().getTotalRowCount() + "\n");

java.util.Iterator <AesProcessInstanceDetail> it =
response.getResponse().getRowDetails().getItem().iterator();
AesProcessInstanceDetail currentRow;
while (it.hasNext()) {
currentRow = it.next();
System.out.println("Process ID: " + currentRow.getProcessId());
System.out.println("Process Name: " + currentRow.getName());
System.out.println("Process State: " + currentRow.getState());
System.out.println("Date Started: " + currentRow.getStarted());
System.out.println("Date Ended: " + currentRow.getEnded());
System.out.println();
}

} catch(Exception e) {
e.printStackTrace();
}
}
}