Submitting batch jobs using the job scheduler web service interface

The job scheduler web service interface is used to programmatically submit and manipulate a batch job.

Before you begin

The job scheduler supports programmatic access to its functions over both an EJB interface for Java™ Platform, Enterprise Edition (Java EE) applications and a web service interface for both Java EE and non-Java EE applications. The Web Services Description Language (WSDL) describes the web service interface for the job scheduler.

Develop and install your batch applications.

About this task

This topic describes how to submit a lote job to the job scheduler. It includes a code example that demonstrates how to invoke the planejador de tarefa web service interface.

Procedure

  1. Create a program for submitting batch work.

    The following example demonstrates how to invoke the job scheduler web service interface to submit a batch job.

    Some statements are split on multiple lines for printing purposes.

    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();
          	}
          }
  2. Run the program to submit batch work.

Ícone que indica o tipo de tópico Tópico de Tarefa



Ícone de registro de data e hora Última atualização: July 9, 2016 7:54
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tgrid_xdbguswsi
Nome do arquivo: tgrid_xdbguswsi.html