Creating and editing an operation

You create an operation by using the menu or toolbar of the service component that will contain the operation. The component details of an operation can be modified in the operations editor. The properties of an operation that you can change are name, parent, message exchange pattern (MEP), stub page, references, Recording Studio color, and the linked OSLC-compliant change management system. The properties are technology-specific. The examples shown in this topic are for an HTTP transport . Therefore, the examples will be different than what you will see if you are working with another transport type, such as WebSphere MQ, Oracle Forms, SAP, Java, and so on.

An operation is a set of functions and their specified properties to which calls can be made. An operation can be created in one of two ways:

When the Create an Operation dialog is displayed, provide a name for the new operation and click OK.

You can edit any of the properties of the operation in the following manner:

Changing the name of an operation

You can change the operation name in the operation editor or using the Rename option.
  1. Use the operation editor or use the Rename option.
    • To open the operation editor, double-click the operation or right-click it and select Open from the menu. Enter a new name for the operation in the Name field.
    • Right-click the operation, select Rename from the menu, and enter a new name for the operation in the Rename to dialog.
    Note: The rename check is case-insensitive. If you only change the capitalization of the resource name, the OK button in the Rename dialog option is not enabled.
  2. Click OK to save your changes and close the editor.

Changing the parent of an operation

  1. Open the operation editor.
    The operation wizard
  2. Click Parent. The Select a Resource dialog is displayed.
  3. Locate and select the new parent component and click OK.

Changing the message exchange pattern for an operation

The message exchange pattern (MEP) defines the pattern, schema, and binding for messages that are exchanged by the operation.
  1. Open the operation editor. The Message Exchange Pattern tab is highlighted, by default.
  2. Modify the various properties of the MEP as described in the table:
    Property Description
    Pattern Select the appropriate message pattern (Publish or Request/Reply).
    Schema Select the schema or format that is to be applied to each applicable message type. Click Browse to locate and select a schema (for more information, see Schemas), or click Clear to clear the current selection. Click Properties to view and edit the WSDL message properties (described in WSDL message properties).
    Note: If you specify a Web URL schema for the Request, an additional row of fields is displayed between the Request and Reply rows. Use the Browse button to locate a sub-schema for the Body and Root fields.
    Binding Click Browse to select an existing transport to apply to the operation’s messages. Depending on the transport, configure more message options by using the tabs below the transport selection. For more information, see Messaging transports, formatters, and dynamic formatters.
  3. When finished, click OK to save any changes and close the editor. Otherwise, click or Cancel to close the editor without saving changes.

Changing the stub page for an operation

The Stub properties for an operation define the binding and timeout details that are used to create a stub from the operation.
  1. Open the operation editor and select the Stub tab.
    The Stub page of the Operation editor
  2. Modify the various properties in the dialog as described in the table:
    Property Description
    Transport Click Browse to select an existing transport that is to be applied to the operation’s Stubs. Depending on the transport, you can configure more message options by using the fields below the transport selection. For more information, see Messaging transports, formatters, and dynamic formatters.
    Message Type If available (depending on the selected transport and formatter), select the type of message from the Message Type dropdown menu.
    Filter resource path, Resource Path (HTTP transports only) If you select the Filter resource path check box and enter, for example, /customer in the Resource Path field, the resource path will filter for /customer. The result will however depend on the value you select from the Subpaths drop-down. In this case, if you select Exact path, a request for /customer/orders will not match and HTTP server error 503 (service unavailable) is returned.
    Filter HTTP method(HTTP transports only) Select this option to filter requests by HTTP method type (such as GET and PUT). Select a method from the accompanying list. An HTTP server error 503 (service unavailable) is returned if both the following conditions are met:
    • An HTTP request is received
    • There is no stub currently running with a filter that matches the request
    The Subpaths drop-down box (HTTP transports only)
    This drop-down box enables matching of sub-paths. You can configure a stub to match any request where the first part of the path matches the filter. If the Resource Path is populated when an operation is created, you must select one of the following options:
    • Allow subpaths: This option enables the URL in the HTTP request to include any sub path following the specified Resource Path; that is, it can be an exact match, or it can start with that value and then can contain additional characters after that value. For example, if a stub is listening for messages with the /addNumbers resource path, and this option is selected, the stub also receives messages destined for a resource named /addNumbers*, where * is any sub-path. For example, it would match /addNumbers/mypath, /addNumbers/123/abc/mypath, /addNumbers/123/abc, and so on. This option is primarily meant for new operations created in HCL OneTest™ API 8.5.0 or later.
    • Exact path: This option is for matching only those requests whose paths exactly match the specified Resource Path.
    • Only subpaths: The URL in the HTTP request must start with the given value, and must have additional characters after it. That is, stubs for such an operation will not receive requests that are an exact match for the given value.
    The Allow subpaths and Only subpaths options are useful when you use path parameters, such as a Web URL schema.

    You have a REST API that lists people, and you use a URL path such as /people/ to list all the people and /people/1 (of the pattern /people/{id}) to get the details of a specific person. You create an operation called List all with /people/ for the resource path and have Exact path selected, and another operation called Get person with /people/ for the resource path, but have Only subpaths selected. In this scenario, requests for the Get person operation are distinguished from those for the List all operation based on the ID that is at the end of their path. Alternatively, if you have only one operation (with /people/ as the resource path) to handle both the cases and want the matching to be successful no matter the path contains a person ID (path parameter value), then select Allow subpaths.

    Filter header values (HTTP transports only) Select this option to create a list of services whose messages are processed by the stub. Click New () to add a header to the list. Provide the following information for each new header:
    Name
    The header type. Typically the type is SOAPAction.
    Value
    No restrictions are placed on the value. In the SOAPAction case, specify a URI that identifies the service, enclosed in quotation marks.
    Note: SOAPAction header values are expected to be quoted. Quoted empty string and unquoted empty string are treated as different (unequal) values.

    The Enabled check box is selected by default. If you want to temporarily disable the filter, you can clear this check box.

    You can click Edit to change the Name and Value fields, or click Delete to remove the header from the list.

    Always select the Participate option for stubs.

    Default Timeout Enter the minimum, maximum, and average response times (in milliseconds) that the stub is to use when it replies to requests.
  3. When finished, click OK to save any changes and close the editor. Otherwise, click or Cancel to close the editor without saving changes.

Changing the references for an operation

References show the dependencies that the selected operation has on other items within the system under test. The references that are displayed correspond directly to the dependencies that are displayed in the diagram.
  1. Open the operation editor and select the References tab. Direct references (no components between the operation and the dependency) are displayed in the top portion of the dialog. Indirect references (one or more components link the operation with the dependency) are displayed at the bottom.
  2. To add a reference, click Add and select the resource to which you want to create a dependency.
  3. To remove a reference, select it and click Remove.
  4. When finished, click OK to save any changes and close the editor. Otherwise, click or Cancel to close the editor without saving changes.

Changing the Recording Studio color for an operation

When you are monitoring events in the Recording Studio perspective, events for each operation are displayed in their own unique color. This feature is especially useful if you are viewing events from multiple operations.
  1. Open the operation editor and select the Recording Studio tab.
  2. Click the color box next to Display Color to display the Select color dialog.
  3. Select the tab of the wanted color model (Swatches, HSB, or RGB) and select the wanted color.
  4. Click OK to save the new selection, click Reset to revert to the original color, or click or Cancel to close the dialog without saving changes.
  5. When finished, click OK to save any changes and close the editor. Otherwise, click or Cancel to close the editor without saving changes.

Change the preferred change management integration for an operation

HCL OneTest™ API can be integrated with OSLC-compliant change management systems for raising defects within the context of a HCL OneTest™ API test asset. If multiple change management integrations are configured in the current project, you can override an inherited integration (from an operation or service component higher up the project resource tree) or the default integration under the Change Management tab. You can then specify a different integration to be used for items below the selected operation.

To specify a different or non-default integration for the current operation and its child operations, enable the Override option and select an integration from the list.

Feedback