You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

UNDER PROGRESS

 

Web Services 

Any job or job chain  in the JobScheduler can be exposed as a Web Service. The JobScheduler accept SOAP requests and send a standard SOAP response. 

It is important here to differentiate between the two types of Web Service requests: 

  • Asynchronous Web Service Requests

    The caller receives an acknowledgement that his request has been accepted by the JobScheduler and will be processed. Job execution is done asynchronously i.e. at a later run time. This is useful if batch jobs need execution time or should start at a predefined point in time. 

    No changes to job implementations are required with asynchronous Web Services processing. 

  • Synchronous Web Service Requests

    Should a request be received by the JobScheduler then it will be instantly processed. The caller receives the job execution result on the fly. Jobs must be developed to handle this kind of request.


Configure JobScheduler 

  • Update  scheduler.xml with a generic web service interface. Following configuration will enable the JobScheduler to accept variety of SOAP requests.

    <http_server >			
    	<web_service
             debug = "no"
             request_xslt_stylesheet = "config/scheduler_soap_request.xslt"
             response_xslt_stylesheet = "config/scheduler_soap_response.xslt"
             name = "scheduler"
             url_path = "/scheduler" >
        </web_service>
    	
        <http_directory  path="${SCHEDULER_DATA}/" url_path="/scheduler_data/"/>
        <http_directory  path="${SCHEDULER_HOME}/" url_path="/scheduler_home/"/>
    </http_server>
  • After scheduler.xml update to make configuration effective, restart the JobScheduler service ( Windows ) or demon ( Linux ).
  • Now the JobScheduler is accessible via a SOAP web service. Web service  can be accessed with URL http://<jobscheduler-host>:<jobscheduler-port>/scheduler  e.g. http://localhost:4444/scheduler

 

SOAP envelop 

  • Any JobScheduler XML command can be embedded in the SOAP envelop. 

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
       
       <!-- JobScheduler XML command -->
     
     
       </soapenv:Body>
    </soapenv:Envelope>
  • See the TBD JobScheduler XML command documentation

 

 

Start a job chain

  • To start a job chain via SOAP web service SOAP client should send a post request to the JobScheduler with following SOAP format

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
          <addOrder xmlns="http://www.sos-berlin.com/scheduler">
             <jobchain>examples/01_JobChainShellJobs/01_JobChainA</jobchain>
             <title>soaptest</title>
             <param>
                <name>SOAP_PARAM1</name>
                <value>Value1</value>
             </param>
             <param>
                <name>SOAP_PARAM2</name>
                <value>Value2</value>
             </param>
          </addOrder>
       </soapenv:Body>
    </soapenv:Envelope>
  • Above given SOAP request will submit a order to the job chain example/01_JobChainShellJobs/01_JobChainA . The order will also have two parameters SOAP_PARAM1=Value1 and SOAP_PARAM2=Value2, which will be passed to the job chain.
  • SOAP request received by the JobScheduler will processed immediately and order id will be send back with response as success token. 

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Body>
        <sos:orderId xmlns:sos="http://www.sos-berlin.com/scheduler">100635</sos:orderId>
      </soapenv:Body>
    </soapenv:Envelope>

 

Start a Job

 

  • To start a job  via SOAP web service SOAP client should send a post request to the JobScheduler with following SOAP format

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
          <startJob xmlns="http://www.sos-berlin.com/scheduler">
             <job>sos/housekeeping/scheduler_rotate_log</job>
             <at>now+60</at>
          </startJob>
       </soapenv:Body>
    </soapenv:Envelope>
  • Above given SOAP request will start the job  sos/housekeeping/scheduler_rotate_log. The job will be started after 60 seconds of time of SOAP request.
  • SOAP request received by the JobScheduler will processed immediately and task id will be send back with response as success token. 

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
          <sos:taskId xmlns:sos="http://www.sos-berlin.com/scheduler">17641247</sos:taskId>
       </soapenv:Body>
    </soapenv:Envelope>

     

     

 


  • No labels