Using Web Services

The following topic covers both inbound and outbound web services.

Procedure

Map a Web Service to a Job Definition

To map a web service to a Job Definition:

  1. Click the Published Web Services tab.
  2. Click Add.
  3. Choose Edit from the Job Definition you want to map to a web service.
  4. Enter the web service URL in the WSURL field.

Create an UpdateJob1 Web Service

To create an UpdateJob1 web service:

  1. Navigate to Configure > Automate > Job Definitions.
  2. Choose New Job Definition and Select Web Service.
  3. Fill http://<host>:<port>/<context>/api-soap/update/Job/UpdateJob1?WSDL into the WSDL URL field.
  4. Choose Next.
  5. Select UpdateJobPortType -> UpdateJob1.
  6. Choose Next.
  7. Optionally, if you want to test your settings, fill a valid ID into the JobIdentifierIn field and choose Test.
  8. Optionally, if this Job Definition is used to update the status of an asynchronous process, select StatusIn.
  9. Choose Save.
  10. In the Job Definition Editor, choose Save & Close.

Create a Job Definition for Asynchronous Processes

  1. Navigate to Configure > Automate > Job Definitions.
  2. Click New.
  3. Choose Redwood Scripting Language from the Type dropdown list.
  4. Enter a name in the Name field.
  5. Paste the code under \Asynchronous Job Definition Source into the Source field.
  6. On the Published Web Services tab, click Add.
  7. Click Save & Close.

Asynchronous Job Definition Source

Copy
import com.redwood.scheduler.api.model.enumeration.CompletionStrategyType;
{
jcsJobContext.setCompletionStrategy(CompletionStrategyType.External);
}

Values

Published Web Services Tab

Field Description
Name The name of the web service, usually WS_ followed by the Job Definition name.
Description An optional description.
Documentation An optional comment for the web service.
Add Note Should a note be added to the Job when this Job Definition is submitted by a web service?
WSURL Web service URL. The default is http://<server>:<port>/<context>/submit/WS_<Process_definition>.

Example

The following examples use the inbound and outbound RunMyJobs web services for illustration purposes. It does not make much sense to create an asynchronous process in RunMyJobs and update it via a RunMyJobs web service with a third RunMyJobs web service Job Definition.

Create the Asynchronous Job Definition

  1. Navigate to Configure > Automate > Job Definitions.
  2. Click New.
  3. Choose Redwood Scripting Language from the Type dropdown list.
  4. Enter MSLN_ANSYC_JOB in the Name field.
  5. Pasted the code in section Asynchronous Job Definition Source in the Source field.
  6. On the Published Web Services tab, click Add.
  7. Click Save & Close.

Create the UpdateJob1 Web Service

  1. Navigate to Configure > Automate > Job Definitions.
  2. Choose New Job Definition and Select Web Service.
  3. Fill http://pr1.example.com:50000/redwood/api-soap/update/Job/UpdateJob1?WSDL into the WSDL URL field.
  4. Choose Next.
  5. Select UpdateJobPortType -> UpdateJob1.
  6. Choose Next.
  7. Select StatusIn.
  8. Choose Save.
  9. In the Job Definition Editor, choose Save & Close.

Create a Web Service Job Definition to Submit MSLN_ANSYC_JOB

  1. Navigate to Configure > Automate > Job Definitions.
  2. Choose New Job Definition and Select Web Service.
  3. Fill http://pr1.example.com:50000/redwood/api-soap/submit/WS_MSLN_ANSYC_JOB?wsdl into the WSDL URL field.
  4. Select SubmitMSLN_ANSYC_JOBPortType -> SubmitJob.
  5. Choose Next.
  6. Choose Save.
  7. Click Save & Close.

Submit MSLN_ANSYC_JOB from a Web Service and update its Status

  1. Navigate to Configure > Automate > Job Definitions.
  2. Choose Run from the context menu of SOAP_SubmitWS_MSLN_ANSYC_JOBPortType_SubmitJob.
  3. Click Run.
  4. Navigate to "Monitoring > Processes".
  5. Locate the process for MSLN_ANSYC_JOB, check its status is Running and write down the ID.
  6. Navigate to Configure > Automate > Job Definitions.
  7. Choose Run from the context menu of SOAP_UpdateJobPortType_UpdateJob1.
  8. Fill the ID of the MSLN_ANSYC_JOB process into the JobIdentifierIn field.
  9. Click Run.
  10. Navigate to "Monitoring > Processes".
  11. Locate the process for MSLN_ANSYC_JOB, check its status is Completed.