Sequence Step in WebMethods

 Sequence Step in WebMethods :

In webMethods, a sequence step is a fundamental building block used to define the flow of integration processes or services. It allows you to define a sequence of actions or steps that need to be executed in a specific order. Each step represents a specific task or action that contributes to the overall functionality of the integration process.

Here’s an overview of how sequence steps work in webMethods:

  • Integration Developer: To define a sequence in webMethods, you typically use the Integration Developer tool, which is part of the webMethods suite. Integration Developer provides a graphical interface where you can design and configure integration processes.
  • Sequence Structure: In Integration Developer, you can create a new integration process or open an existing one. Within the process, you can define a sequence step by adding a Sequence flow object to the process flow canvas.
  • Adding Steps: Once you’ve added a Sequence object, you can open it to view and configure the sequence steps. You can add steps by dragging and dropping various flow objects from the Palette onto the sequence canvas.
  • Configuring Steps: Each step in the sequence represents a specific action or task that needs to be performed. Depending on the requirements of your integration process, you can configure these steps to perform actions such as invoking web services, manipulating data, making routing decisions, logging information, or interacting with external systems.
  • Connecting Steps: After adding and configuring the steps, you can connect them to define the flow of execution. Connections between steps indicate the order in which they will be executed. You can establish connections by drawing lines between the output ports of one step and the input ports of the next step.
  • Conditional Flow: In addition to defining a linear sequence of steps, you can introduce conditional branching within the sequence. This allows you to define different paths of execution based on specific conditions or variables. Conditional flow objects like the Branch and Switch steps can be used to implement these branching scenarios.
  • Error Handling: Sequence steps also provide error-handling capabilities. You can configure exception handlers within the sequence to catch and handle errors that may occur during the execution of individual steps. This ensures robustness and enables appropriate error recovery or exception-handling strategies.
  • Testing and Deployment: Once you have defined and configured the sequence steps, you can test the integration process within the Integration Developer environment. You can deploy the process to a webMethods Integration Server for execution in a production environment.
  • By using sequence steps effectively, you can create complex integration processes or services that orchestrate various actions and interactions, enabling seamless integration and communication between different systems or applications.Let’s understand the properties of Sequence first.
    • Create a flow service with the name sequenceDemo.

       

    • Now add one sequence step in the flow and see the properties.

       

    • Now let’s understand the properties first.
      • Comments : The comment properties in sequence properties in webMethods are used to provide descriptive or explanatory information within the code, aiding in documentation and understanding of the sequence of actions or steps being performed.
      • Scope : The scope properties in sequence properties in webMethods are used to define the visibility and accessibility of variables within the sequence, allowing for proper data handling and control within the scope of the sequence.
      • TimeOut : The timeout properties in sequence properties in webMethods are used to specify a maximum duration for the execution of the sequence, ensuring that it completes within a specified time limit.
      • Label : The label properties in sequence properties in webMethods serve the purpose of assigning a meaningful and recognizable name to a sequence, facilitating its identification and organization within the webMethods integration platform.
      • Exit On : The “exit on” properties in sequence properties in webMethods are used to define conditions or criteria that, when met, allow for the early termination or exit from the sequence, optimizing the execution flow based on specific requirements, It contains three options.
        • Failure : It is used to specify that the sequence should terminate if any step within the sequence encounters a failure or error condition, allowing for quick identification and handling of failures in the execution flow.
        • Success : It is used to specify that the sequence should terminate if all steps within the sequence successfully complete without encountering any failure or error, optimizing the execution flow based on successful outcomes.
        • Done : It is used to specify that the sequence should terminate when all steps within the sequence have completed, regardless of whether they were successful or encountered failures, ensuring that the sequence finishes its execution before proceeding to the next step.
    • Now I believe you have understood all the properties of Sequence.


Now it’s time to have some exercise hope you will enjoy it😊

Exercise – 1 : Write a flow service to implement Try Catch using sequence.
Ans : 

  1. Hope you have created the flow service mentioned above, let’s begin where we left.
  2. Let’s see the structure first before implementing it.

     

  3. As you can see in the above picture we have a main sequence, now we need to decide what should be the Exit On property, as you know we need only execute the try block and in case any error occurred in the Try block control should move to Catch block, so for this we need to put the Exit On property to Success.

     

  4. Now add two more sequence steps as a child of the main Sequence.

     

  5. Let’s decide what should be the Exit On property for the first child sequence, as you know we want to implement a try block using sequence so basically we always have all our code into the try block and execute everything, and in case an error occurred the control should move to next sequence(Catch), so we need to make the Exist On property to Failure means it should exit the flow when an error occurs.

     

  6. Now let’s finalize what we need to put on Exit On property to make it work as a Catch block, as you know in a catch block we need to get the error and we may need the error handling framework to log or any other task you want to perform like email/raise a ticket etc. As per our requirement, we need to make the Exit On property to Done to execute each and every step in the Catch block.

     

  7. Now let’s throw an exception from try block and see if it is working properly.
  8. Now in the Try block sequence invoke pub.flow:throwExceptionForRetry.

     

  9. Now set the value for the  message variable with the message “Exception thrown to Test Try -Catch”.

     

  10. Now we have completed the steps to throw an exception and now we need to catch the exception.
  11. Now in the catch block invoke pub.flow:getLastError to catch the error(remember this service needs to be invoked in the first step of the catch block to get the error details).

     

  12. Now we have the error details, let’s log it into the server log.
  13. To log the error invoke pub.flow:debugLog after the getLastError step and map the lastError/error to the message variable of debug log.

     

  14. Now let’s run it and see the output.

     


Hope you have enjoyed this article, click below download button to download the source code😊.

 

Download Package
 



Leave a Comment