작업 스케줄러 웹 서비스 인터페이스는 일괄처리 작업을 프로그래밍
방식으로 제출하고 조작하는 데 사용됩니다.
시작하기 전에
작업 스케줄러는 Java EE(Java™ Platform,
Enterprise Edition) 애플리케이션의 EJB 인터페이스와 Java EE 및 비Java EE
애플리케이션 모두의 웹 서비스 인터페이스를 통해 해당 기능에 대한
프로그래밍 방식 액세스를 지원합니다. WSDL(Web Services Description
Language)은 작업 스케줄러의 웹 서비스 인터페이스에 대해 설명합니다.
일괄처리
애플리케이션을 개발하고 설치하십시오.
이 태스크 정보
이 주제에서는 작업 스케줄러에
일괄처리 작업을 제출하는 방법에 대해
설명합니다. 여기에는
작업 스케줄러
웹 서비스 인터페이스를 호출하는 방법을 보여주는 코드 예가
있습니다.
프로시저
- 일괄처리 작업을 제출하기 위한 프로그램을 작성하십시오.
다음 예는
일괄처리 작업을 제출하기 위한 작업 스케줄러 웹 서비스 인터페이스를
호출하는 방법을 보여줍니다.
일부 구문은 인쇄를 위해 여러 행으로 나눠집니다.
import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.encoding.XMLType;
Call call = null;
String lrsHostName = "localhost";
String lrsPort = "9080";
private String readXJCL() throws FileNotFoundException, IOException {
// Code to read xJCL file into a String
}
public void submitJob() {
String endPoint =
"http://"+lrsHostName+":"+lrsPort+"/LongRunningJobSchedulerWebSvcRouter/
services/JobScheduler";
try {
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service service = serviceFactory.createService(new
QName("http://longrun.websphere.ibm.com", "JobSchedulerService"));
call = (Call) service.createCall();
call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,
"http://schemas.xmlsoap.org/soap/encoding/");
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped");
call.setPortTypeName(new
QName("http://longrun.websphere.ibm.com", "JobSchedulerService"));
call.setTargetEndpointAddress(endPoint);
//remove all parameters from call object
call.removeAllParameters();
call.setReturnType(XMLType.SOAP_STRING, null);
call.addParameter("arg", XMLType.SOAP_STRING, ParameterMode.IN);
call.setOperationName(new QName("http://longrun.websphere.ibm.com","submitJob"));
String xjcl = readXJCL(); // Method to read xJCL file into a string
call.invoke(new Object[] {xjcl});
} catch (ServiceException se) {
System.out.println("Service Exception: " + se.getMessage());
se.printStackTrace();
} catch (java.rmi.RemoteException re) {
System.out.println("Remote Exception: " + re.getMessage());
re.printStackTrace();
}
}
- 일괄처리 작업을 제출하기 위한 프로그램을 실행하십시오.