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

Compare with Current View Page History

« Previous Version 17 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. 

The JobScheduler can be configured to except start job and job chain requests either

  • via a generic JobScheduler Webservice interface or  

    <web_service
         ...
         name = "scheduler"
         url_path = "/scheduler" >
    </web_service>
  • via  specific Webservice interface for a individual job or job chain. 

    <web_service
         ...
         name = "start_backup"
         url_path = "/start_backup" >
    </web_service>

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_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

 

Web Services

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

Asynchronous Web Service Requests 

The Asynchronous Web Services Request feature is marked as deprecated  see   JS-1347 - Getting issue details... STATUS   for more information. 

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. 

 

         

 

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>

Check Order Status

To Check the status of order's status sent to JobSceduler send following SOAP request to the JobScheduler

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <showOrder xmlns="http://www.sos-berlin.com/scheduler">
         <jobchain>examples/01_JobChainShellJobs/01_JobChainA</jobchain>
         <order>100638</order>
      </showOrder>
   </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>

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.

 

 Configuration of a Synchronous Web Service

Before the Job Scheduler can support the Synchronous  Web Service, it is necessary to configure a job chain in the scheduler.xml configuration file.

The following Job and Job Chain element must be configured in the JobScheduler. 

Job Chain
<job_chain name="web_service_test">
   <job_chain_node state="1" job="web_service_test_job" next_state="100" error_state="999" />
   <job_chain_node state="100"/>
   <job_chain_node state="999"/>
</job_chain>

 

Although job chains usually consist of a number of jobs, the example chain has only the one  job. This job is configured as follows in the <jobs> element:

web_service_test_job
 <job name       = "web_service_test_job"
     order      = "yes">
    <script language      = "java"
            java_class    = "sos.scheduler.service.WebServiceTestJob"/>         
</job>

 

In order that this job chain can be used as a synchronous Web Service, a new Web Service needs to be created in the <web_services> element 

Configure JobScheduler 

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

    <http_server >			
    
    <web_service name="test"
            job_chain="web_service_test"
            url_path="/test"/>
    </http_server>
  • After scheduler.xml update to make configuration effective, restart the JobScheduler service ( Windows ) or demon ( Linux ).

 

Change Management References

T Key Linked Issues Fix Version/s Status P Summary Updated
Loading...
Refresh

 


  • No labels