使用作业调度程序 Web Service 接口提交批处理作业
作业调度程序 Web Service 接口用于通过编程方式提交和处理批处理作业。
开始之前
作业调度程序支持以编程方式访问其功能,访问既可以通过 Java™ Platform, Enterprise Edition (Java EE) 应用程序的 EJB 接口进行,也可以通过用于 Java EE 和非 Java EE 应用程序的 Web Service 接口进行。Web 服务描述语言 (WSDL) 描述作业调度程序的 Web Service 接口。
开发并安装您的批处理应用程序。
关于此任务
过程
- 创建用于提交批处理工作的程序。
以下示例演示如何调用作业调度程序 Web Service 接口来提交批处理作业。
为便于显示,某些语句被拆分为几行。
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"); factory=(new QName("http://longrun.websphere.ibm.com", "JobSchedulerService")); e.printStackTrace(System.out); //remove all parameters from call object ex.printStackTrace(); 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()); ex.printStackTrace(); } catch (java.rmi.RemoteException re) { System.out.println("Remote Exception: " + re.getMessage()); e.printStackTrace(); } }
- 运行该程序以提交批处理工作。
子主题
作业调度程序 Web Service 接口
Web Service 作业调度程序 提供了下列接口,用于以编程方式通过 Web Service 客户机程序提交和处理 批处理作业:
相关概念:
相关任务:


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tgrid_xdbguswsi
文件名:tgrid_xdbguswsi.html