Submitting batch jobs using the job scheduler web services interface

The job scheduler web services 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 services interface for both Java EE and non-Java EE applications. The Web Services Description Language (WSDL) describes the web services interface for the job scheduler that is listed under the job scheduler web services interface.

Develop and install your batch applications.

About this task

This topic describes how to submit a batch job to the job scheduler. It includes a code example that demonstrates how to invoke the job scheduler web services interface.

Procedure

  1. Create a program for submitting batch work.

    The following example demonstrates how to invoke the job scheduler web services 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.



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Feb 6, 2014 8:11:25 PM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-mp&topic=tgrid_xdbguswsi
File name: tgrid_xdbguswsi.html