Soumission de travaux par lots à l'aide de l'interface de service Web du planificateur de travaux

L'interface de service Web du planificateur de travaux est utilisée pour soumettre et manipuler un travail par lots à l'aide d'un programme.

Avant de commencer

Le planificateur de travaux prend en charge l'accès par programmation à ses fonctions via une interface EJB pour des applications Java™ Platform, Enterprise Edition (Java EE) et une interface de service Web pour les applications Java EE et non Java EE. WSDL (Web Services Description Language) décrit l'interface de service Web du planificateur de travaux.

Développez et installez vos applications par lots.

Pourquoi et quand exécuter cette tâche

Cette rubrique explique comment soumettre un travail traitement par lots au planificateur de travaux. Elle inclut un exemple de code décrivant comment appeler l'interface de service Web du planificateur de travaux.

Procédure

  1. Créez un programme pour la soumission du travail par lots.

    L'exemple suivant décrit comment appeler l'interface de service Web du planificateur de travaux pour soumettre un travail par lots.

    Certaines instructions sont présentées sur plusieurs lignes à des fins d'affichage.

    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. Exécutez le programme pour soumettre le travail par lots.

Icône indiquant le type de rubrique Rubrique de tâche



Icône d'horodatage Dernière mise à jour: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tgrid_xdbguswsi
Nom du fichier : tgrid_xdbguswsi.html