CloudStreams 10.5 | webMethods CloudStreams | webMethods CloudStreams Development | CloudStreams Provider Project | Editing the Connection Properties | Start and Stop Sequences for REST-based providers
 
Start and Stop Sequences for REST-based providers
CloudStreams allows you to define optional Start and Stop sequences, which lets you to manage the connection behavior. For example, you can call a resource to initiate a session with the back end as part of the connection start up, and perform the necessary clean up as part of the stop sequence. When you create a connector, the Start Sequence and Stop Sequence options appear under Connection on the left pane. You can add only one start and one stop sequence for a connection.
To add a Start Sequence
1. Right-click Start Sequence under Connection on the left pane and select Add Start Sequence.
The Configure Resource dialog box appears.
2. Specify the Start Sequence details. The Start Sequence will be generated for the selected HTTP method.
Field
Description
Endpoint
Displays the login endpoint URL to initiate communication with the SaaS provider and cannot be edited.
Path
Type the path that you want to use for the resource. Each REST resource derives its path from the namespace of the REST resource.
Methods
Select the Method. The start sequence will be generated for the selected HTTP method.
3. Click Next.
4. In the Configure Start Sequence Input dialog box, select a document reference and if needed, assign values from the given options.
Field
Description
Document Reference
Click Browse and select a Document Reference, for example myConnector_v1.customDoctypes:docTypeRef_LoginInput.
Request Body
Represents the input of the document reference. All required fields must be independently populated using the assignment functionality for each field.
To assign values to a leaf element, right-click on the leaf element and select Assign From. For example, you can refer a connection parameter defined in the connection.
Content Type
Specify the Content Type of the Document Reference, for example, application/xml.
5. Click Next.
6. In the Configure Start Sequence Output dialog box, select a document reference and if needed, assign values to the given options. Also, specify a response code. Only one response is currently allowed.
Field
Description
Document Reference
Click Browse and select a Document Reference, for example myConnector_v1.customDoctypes:docTypeRef_LoginOutput.
Response Code
Specify a code, such as 200-500. Response codes can be comma separated or a range.
Response Body
Represents the output of the document reference. Optionally, you can assign values from the output to the supported parameters to be used in resource interactions.
To assign values to a leaf element, right-click on the leaf element and select Assign To. For more information, see Assigning Values.
Error Handling
Select Use a service to configure the error message if you want to handle the error messages sent by the back end for requests that are not successful. Click Browse and in the Services pane, select the custom service that you have created. This service is needed to read and display error messages for unsuccessful requests.
Note:
By default, CloudStreams automatically handles errors and flags connection errors. However, if you want to handle the response on your own in a customized way, you need to create and use a service (which follows the service mapping spec wm.cloudstreams.service.common.lookup.specs:mapServiceSpec), which returns an output that is treated as an error message. If the service does not return an output, it is treated as success.
Content Type
Displays the content type of the Document Reference.
Note: 
As an example, if the Endpoint is https://instance.abc.region, Path is /networking/rest/login?alt=xml, and the selected Method as mentioned in the back end documentation is POST, and if you have selected the Document References for both Input and Output, and have provided the Response Code, the Start Sequence gets created. While enabling the connection, the Start Sequence is called and based on the Start Sequence configuration, necessary actions will be performed.
7. Click Finish.
The details appear in the Overview pane.
8. To configure a Stop Sequence, right-click Stop Sequence under Connection, select Add Stop Sequence, and configure a Stop Sequence in a similar manner.
Note:
While enabling or disabling the connection in Integration Server Administrator, the start or stop sequences, if configured, will be run respectively.