Web Services Jobs
The following topics describe job types for web services:
Job:WebServices
Control-M for Web Services enables you to schedule standard web services, servlets, and RESTful web services.
A web service is XML-based software that enables electronic devices to communicate via intranet or the internet. Servlets are small, Java-based programs that run on web servers, can access databases in response to user input, and add dynamic content to web sites. RESTful web services conform to the Representational State Transfer (REST) software architectural model and are used to create APIs for web-based applications.
To deploy and run these types of jobs, ensure that you have done the following:
-
Installed Control-M for Web Services, Java, and Messaging, as described in Control-M for Web Services, Java, and Messaging Installation.
-
Created a connection profile, as described in ConnectionProfile:WebServices.
The following examples show how to define a Web Services job.
-
This JSON defines a Web Services job that receives input for a calculator service and outputs the result of a simple calculation:
Copy"WebServices_Job":
{
"Type": "Job:WebServices",
"Location": "http://www.dneonline.com/calculator.asmx?WSDL",
"SoapHeaderFile": "c:\\myheader.txt",
"Service": "Calculator(Port:CalculatorSoap)",
"Operation": "Add",
"RequestType": "Parameter",
"OverrideUrlEndpoint": "http://myoverridehost.com",
"OverrideContentType": "*/*",
"HttpConnectionTimeout": "2345",
"PreemptiveHttpAuthentication": "[email protected]",
"IncludeTitleInOutput": true,
"ExcludeJobOutput": false,
"ConnectionProfile": "CALCULATOR",
"Host": "host1",
"OutputParameters": [
{
"Element": "AddResponse.AddResult",
"HttpCode": "*",
"Destination": "testResultAdd",
"Type": "string"
} ],
"InputParameters": [
{
"Name": "Add.intA",
"Value": "97",
"Type": "string"
},
{
"Name": "Add.intB",
"Value": "345",
"Type": "string"
} ],
} -
This JSON defines a Web Services job that receives all input through a SOAP request to a calculator service and outputs the result of a simple calculation:
Copy"WSSoapRequest":
{
"Type": "Job:WebServices",
"SoapHeaderFile": "c:\\myheader.txt",
"Location": "http://www.dneonline.com/calculator.asmx?WSDL",
"Service": "Calculator(Port:CalculatorSoap)",
"Operation": "Add",
"RequestType": "FreeText",
"OverrideUrlEndpoint": "http://myoverridehost.com",
"OverrideContentType": "*/*",
"HttpConnectionTimeout": "2345",
"PreemptiveHttpAuthentication": "[email protected]",
"IncludeTitleInOutput": true,
"ExcludeJobOutput": false,
"ConnectionProfile": "CALCULATOR",
"Host": "host1",
"OutputParameters": [
{
"Element": "AddResponse.AddResult",
"HttpCode": "*",
"Destination": "testResultAdd",
"Type": "string"
} ],
"Request": [
"<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/ xmlns:tem=http://tempuri.org/>
<soapenv:Header/>
<soapenv:Body>
<tem:Add>
<tem:intA>98978</tem:intA>
<tem:intB>75675</tem:intB>
</tem:Add>
</soapenv:Body>
</soapenv:Envelope>" ],
} -
This JSON defines a Web Services job that receives a SOAP request through an input file. It then uses the input file to submit a SOAP request to a calculator service, and outputs the result of a simple calculation:
Copy"WSSoapRequest_InputFile":
{
"Type": "Job:WebServices",
"SoapHeaderFile": "c:\\myheader.txt",
"Location": "http://www.dneonline.com/calculator.asmx?WSDL",
"Service": "Calculator(Port:CalculatorSoap)",
"Operation": "Add",
"RequestType": "InputFile",
"OverrideUrlEndpoint": "http://myoverridehost.com",
"OverrideContentType": "*/*",
"HttpConnectionTimeout": "2345",
"PreemptiveHttpAuthentication": "[email protected]",
"IncludeTitleInOutput": true,
"ExcludeJobOutput": false,
"ConnectionProfile": "CALCULATOR",
"Host": "host1",
"OutputParameters": [
{
"Element": "AddResponse.AddResult",
"HttpCode": "*",
"Destination": "testResultAdd",
"Type": "string"
} ],
"InputFile": "/home/usr/soap.xml"
} -
This JSON defines a Web Services job that receives input for a calculator REST service and outputs the result of a simple calculation:
Copy"REST_Service_Job":
{
"Type": "Job:WebServices",
"Location": "http://www.dneonline.com",
"Service": "/restAPI/calculator.asmx",
"Operation": "PUT",
"RequestType": "Parameter",
"OverrideContentType": "*/*",
"HttpConnectionTimeout": "2345",
"PreemptiveHttpAuthentication": "[email protected]",
"IncludeTitleInOutput": true,
"ExcludeJobOutput": false,
"ConnectionProfile": "CALCULATOR_REST",
"Host": "host1",
"OutputParameters": [
{
"Element": "$AddResponse.AddResult",
"HttpCode": "*",
"Destination": "testResultAdd",
"Type": "string"
} ],
"InputParameters": [
{
"Name": "intA",
"Value": "97",
"Type": "string"
},
{
"Name": "intB",
"Value": "345",
"Type": "string"
},
{
"Name": "accept-encoding",
"Value": "*/*",
"Type": "header"
} ],
}
The following table describes the Web Services job parameters.
Parameter |
Description |
---|---|
ConnectionProfile |
Defines the ConnectionProfile:WebServices name that connects Control-M to the web service. |
SoapHeaderFile |
(Web service only): Defines the path to a file that contains a predefined SOAP Header to add to the invocation of the target web service SOAP message. |
Location |
(Either web service or REST service): Defines a URL, or (Web service) Defines a fully qualified filename that points to the WSDL of the web service. |
Service |
Defines the service provided by the company or business.
|
Operation |
(Web service): Defines an operation available for the specified service. (REST service): Defines the HTTP method for REST job execution (GET, POST, PUT, DELETE, HEAD, or OPTIONS). |
RequestType |
Determines one of the following sources of the payload request to submit. The payload can be either a SOAP request (in the case of a web service) or a JSON/XML string (in the case of a REST service).
|
OverrideUrlEndpoint |
(Web service only): Defines the URL endpoint at the job definition level. Upon job submission Control-M for Web Services uses the job definition's Endpoint URL, rather than the address location in the WSDL. |
OverrideContentType |
Defines a preferred HTTP header Content-Type to be used to execute the job. |
HttpConnectionTimeout |
Determines the maximum number of seconds to wait for the web service to respond before disconnecting. |
PreemptiveHttpAuthentication |
Defines HTTP Basic Authentication information in the format of <user>@<realm>. This information must match the HTTP Basic Authentication information defined through the connection profile (not including the password). |
IncludeTitleInOutput |
Determines whether an Output banner is written to the Output at the end of job execution. Values:
Default: true |
ExcludeJobOutput |
Determines whether to exclude information about job output from the Output at the end of job execution. Values:
Default: false |
OutputParameters |
Defines the outcome of selected output parameters. For each output parameter, define the following sub-parameters:
|
InputParameters |
Defines details of the input parameters required by the web service. For each input parameter, define the following sub-parameters:
|
Request |
Free-text request to submit to the service, one of the following:
This parameter is relevant only if RequestType is set to FreeText. |
InputFile |
The fully qualified path to an input file that contains a complete request to submit to the service — either a full SOAP request (for a web service), or a JSON or XML string (for a RESTful service). This parameter is relevant only if RequestType is set to InputFile. |
Job:Web Services REST
Web Services REST jobs enable you to design and execute single REST API calls.
To deploy and run a Web Services REST job, ensure that you have completed the following:
-
Configured the Control-M Application Integrator plug-in, as described in Application Integrator Configuration.
-
Installed the Web ServicesREST plug-in with the provision image command (Control-M/EM 9.0.21 or higher) or the deploy jobtype command (Control-M/EM 9.0.20.200 or lower).
The following example shows how to define a Web Services REST job with a defined body:
"Web Services REST_output_parameters":
{
"Type": "Job:Web Services REST",
"ConnectionProfile": "REST_OAUTH2",
"Method": "POST",
"Append Request": "checked",
"Append Response": "checked",
"Endpoint URL": "https://6943019930999707.net",
"URL Request Path": "/api/2.1/jobs/run-now",
"URL parameters" : [
{
"FilterValue" : "Untitled Workflow"
}
],
"HTTP Headers": [
{ "Authorization": "bearer" }
],
"WsRestBody" :
{
"RequestDefinition" : "text",
"BodyRequest" : "{%4E\"Job Identifier\": \"some-unique-id-000x\"%4E}"
},
"OutputHandling": [
{
"HttpCode": "*",
"Parameter": "$.run_id",
"Variable": "file:/home/dbauser/temp.txt"
},
{
"HttpCode": "*",
"Parameter": "$.run_id",
"Variable": "LOCAL_CTM_VAR"
},
{
"HttpCode": "*",
"Parameter": "$.run_id",
"Variable": "\\GLOBAL_CTM_VAR"
} ]
}
The following example shows the same Web Services REST job as above, but the request body is obtained from a local file:
"Web Services REST_output_parameters":
{
"Type": "Job:Web Services REST",
"ConnectionProfile": "REST_OAUTH2",
"Method": "POST",
"Append Request": "checked",
"Append Response": "checked",
"Endpoint URL": "https://6943019930999707.net",
"URL Request Path": "/api/2.1/jobs/run-now",
"URL parameters" : [
{
"FilterValue" : "Untitled Workflow"
}
],
"HTTP Headers": [
{ "Authorization": "bearer" }
],
"WsRestBody" :
{
"RequestDefinition" : "filename",
"FileName" : "/home/jobdefs/request-body.txt"
},
"OutputHandling": [
{
"HttpCode": "*",
"Parameter": "$.run_id",
"Variable": "file:/home/dbauser/temp.txt"
},
{
"HttpCode": "*",
"Parameter": "$.run_id",
"Variable": "LOCAL_CTM_VAR"
},
{
"HttpCode": "*",
"Parameter": "$.run_id",
"Variable": "\\GLOBAL_CTM_VAR"
} ]
}
The following table describes the Web Services REST job parameters.
Parameter |
Description |
---|---|
ConnectionProfile |
Defines the ConnectionProfile:Web Services REST name that connects Control-M to Web Services REST. |
Endpoint URL |
Defines the endpoint base URL, which is the common resource prefix that the API uses to navigate. |
URL Request Path |
Defines the URL request path. |
Method |
Determines one of the following HTTP methods that is used to execute the REST job:
|
URL parameters |
Defines optional URL parameters, as an array of Key:Value pairs. |
HTTP Headers |
Defines optional HTTP headers, as an array of Key:Value pairs. If you created a connection profile that authenticates with OAuth2, as described in Web Services REST Connection Profile Parameters, you must define the following HTTP header key name and value: "Authorization" : "" |
WsRestBody |
Defines the REST request body, using the following parameters on the next level:
|
OutputHandling |
(Optional) Defines output handling. This parameter enables you to extract values from the service response. You can utilize either JSON or XML format. The parameter consists of the following:
Rules:
|
Connection Timeout |
Determines the number of seconds to wait after Control-M initiates a connection request to Web Services before a timeout occurs. Default: 50 |
Append Request |
Determines whether to append the API request to the output Values:
Default: unchecked |
Append Response |
Determines whether to append the API response to the output. Values:
Default: unchecked |
Job:Web Services SOAP
Web Services SOAP jobs enable you to design and execute single SOAP API calls.
The following example shows how to define a Web Services SOAP job, which enables you to design and execute a single SOAP API call.
To deploy and run a Web Services SOAP job, ensure that you have completed the following:
-
Configured the Control-M Application Integrator plug-in, as described in Application Integrator Configuration.
-
Installed the Web Services SOAP plug-in with the provision image command, for Control-M/EM 9.0.21 or higher, or the deploy jobtype command, for Control-M/EM 9.0.20.200 or lower.
The following example shows how to define a Web Services SOAP job:
"Web Services SOAP_Job_2":
{
"Type": "Job:Web Services SOAP",
"ConnectionProfile": "SOAP_BASIC_AUTH",
"Endpoint URL": "http://vw-usr1:8091/ws/register",
"Append Request": "unchecked",
"Append Response": "unchecked",
"SOAP Action": "http://www.bmc.com/ctmem/#register",
"Variables": [
{
"UCM-SOAP_REQUEST_REQ_TYPE": "xml"
},
{
"UCM-SOAP_REQUEST_SOAP_REQUEST": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sch=\"http://www.bmc.com/ctmem\">%4E <soapenv:Header/>%4E <soapenv:Body>%4E <sch:request_register>%4E <!--Optional:-->%4E <sch:component>?</sch:component>%4E <sch:user_name>?</sch:user_name>%4E <sch:password>?</sch:password>%4E <sch:timeout>?</sch:timeout>%4E <!--Optional:-->%4E <sch:hostname>?</sch:hostname>%4E </sch:request_register>%4E </soapenv:Body>%4E</soapenv:Envelope>"
} ],
"OutputHandling": [
{
"HttpCode": "200",
"Parameter": "//sch:error_message",
"Variable": "CTM_VAR_RESULT"
},
{
"HttpCode": "200",
"Parameter": "//sch:error_message",
"Variable": "file:/home/dbauser/soap_result.txt"
} ],
}
The following table describes the Web Services SOAP job parameters.
Parameter |
Description |
---|---|
ConnectionProfile |
Defines the ConnectionProfile:Web Services SOAP name that connects Control-M to Web Services SOAP. |
Endpoint URL |
Defines the endpoint base URL, which is the common resource prefix that the API uses to navigate. |
SOAP Action |
Defines a single SOAP action (operation), which you must take from the WSDL file. In this example, in the WSDL file, copy the SOAP action http://tempuri.org/SOAP.Demo.AddInteger from the body of the following operation: Copy
|
Request Definition |
Determines one of the following requests to perform:
|
SOAP Request |
Defines the SOAP request. Copy
|
HTTP Headers |
(Optional) Defines HTTP header key names and values. Key: Content-Type Value: application/json |
OutputHandling |
(Optional) Defines the following output parameters:
Rules:
|
Connection Timeout |
Determines the number of seconds to wait after Control-M initiates a connection request before a timeout occurs. Default: 50 |
Append Request |
Determines whether to append the API request to the output Values:
Default: unchecked |
Append Response |
Determines whether to append the API response to the output. Values:
Default: unchecked |