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:
- Click the Published Web Services tab.
- Click Add.
- Choose Edit from the Job Definition you want to map to a web service.
- Enter the web service URL in the WSURL field.
Create an UpdateJob1 Web Service
To create an UpdateJob1 web service:
- Navigate to Configure > Automate > Job Definitions.
- Choose New Job Definition and Select Web Service.
- Fill
http://<host>:<port>/<context>/api-soap/update/Job/UpdateJob1?WSDL
into the WSDL URL field. - Choose Next.
- Select UpdateJobPortType -> UpdateJob1.
- Choose Next.
- Optionally, if you want to test your settings, fill a valid ID into the JobIdentifierIn field and choose Test.
- Optionally, if this Job Definition is used to update the status of an asynchronous process, select StatusIn.
- Choose Save.
- In the Job Definition Editor, choose Save & Close.
Create a Job Definition for Asynchronous Processes
- Navigate to Configure > Automate > Job Definitions.
- Click New.
- Choose Redwood Scripting Language from the Type dropdown list.
- Enter a name in the Name field.
- Paste the code under \Asynchronous Job Definition Source into the Source field.
- On the Published Web Services tab, click Add.
- 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
- Navigate to Configure > Automate > Job Definitions.
- Click New.
- Choose Redwood Scripting Language from the Type dropdown list.
- Enter
MSLN_ANSYC_JOB
in the Name field. - Pasted the code in section Asynchronous Job Definition Source in the Source field.
- On the Published Web Services tab, click Add.
- Click Save & Close.
Create the UpdateJob1 Web Service
- Navigate to Configure > Automate > Job Definitions.
- Choose New Job Definition and Select Web Service.
- Fill
http://pr1.example.com:50000/redwood/api-soap/update/Job/UpdateJob1?WSDL
into the WSDL URL field. - Choose Next.
- Select UpdateJobPortType -> UpdateJob1.
- Choose Next.
- Select StatusIn.
- Choose Save.
- In the Job Definition Editor, choose Save & Close.
Create a Web Service Job Definition to Submit MSLN_ANSYC_JOB
- Navigate to Configure > Automate > Job Definitions.
- Choose New Job Definition and Select Web Service.
- Fill
http://pr1.example.com:50000/redwood/api-soap/submit/WS_MSLN_ANSYC_JOB?wsdl
into the WSDL URL field. - Select SubmitMSLN_ANSYC_JOBPortType -> SubmitJob.
- Choose Next.
- Choose Save.
- Click Save & Close.
Submit MSLN_ANSYC_JOB from a Web Service and update its Status
- Navigate to Configure > Automate > Job Definitions.
- Choose Run from the context menu of SOAP_SubmitWS_MSLN_ANSYC_JOBPortType_SubmitJob.
- Click Run.
- Navigate to "Monitoring > Processes".
- Locate the process for MSLN_ANSYC_JOB, check its status is Running and write down the ID.
- Navigate to Configure > Automate > Job Definitions.
- Choose Run from the context menu of SOAP_UpdateJobPortType_UpdateJob1.
- Fill the ID of the MSLN_ANSYC_JOB process into the JobIdentifierIn field.
- Click Run.
- Navigate to "Monitoring > Processes".
- Locate the process for MSLN_ANSYC_JOB, check its status is Completed.