Skip to content

Retry Call to Web Service

Note: It is recommended that the Neuron process documentation be reviewed before running this sample. The documentation thoroughly describes each process component individually and describes how to configure each one as well as how to construct a process and associate it with a Neuron Publisher or Subscriber. See the Configuration Notes section at the end of this document for more information.


This sample demonstrates the Service and Retry Neuron Process steps. One of the components available in the Neuron Process step collection is a Retry process step that can be used to wrap a Service process step in retry logic to help overcome issues that may occur while calling the web service defined in the Service process step. The Retry step can detect either Communication or System.Exception errors and execute its contained steps a user configured number of times.

Process Components Demonstrated:

  • Retry
  • Service
  • Code
  • Trace


The Retry Service process depicted in Figure 2 has a Retry process step containing a Code process step name “set search name” and a Service process step. The set search name step will be used to set the message content. In order to demonstrate the Retry step we need some means of forcing a timeout to occur in the communication between the process and the actual web service defined in the Service process step. The “set search name” step along with the test service will help us accomplish that. The set search name Code step will create the message sent to the service. With each retry, the message content will be changed. The sample WCF service is configured to “sleep” for any request that it finds invalid. The “sleep” will cause a timeout to occur in the Service process step. On the 3rd attempt, the Code step will send a valid message and the process will “break out” of the Retry step.

Note: This sample requires a WCF service. The Visual Studio solution for this sample service is included with the Neuron samples. See the section titled “Test Service Solution” for details.

The Retry step is configured to trace error messages so this sample will use the Test feature built into the Neuron Process Designer. Testing in the designer allows you to see each step being executed. Trace messages can be seen in the designer’s Trace Window during testing.

The final step in the process is a Trace step. This step will be used to display the resulting message in the Process Designer’s Trace Window from the WCF service called by the Service process step.

Figure 1: Empty Retry process component as displayed in the Neuron Process Designer
Figure 2: Retry Service process as displayed in the Neuron Process Designer

Test Service Solution

The sample WCF service used in the example can be found in the Samples\Processes\RetryWebServiceCall\ServiceProcessService folder under the main Neuron installation folder. The Visual Studio solution is named “ServiceProcessService.sln” and was built with Visual Studio 2008.

Note: If running Windows 7 or Vista, you may have to run this visual studio project as an administrator.

The service has one exposed method that accepts a string “name” and returns a Person object. The Person object collection is seeded with 3 default items. When the method is called it checks the name against one in its list. If found it returns immediately. If not found the method “sleeps” for 5 seconds before returning. This behavior will be used to help demonstrate the Retry process step in this example.

Running the Sample

Open the Sample

To open this sample, see the topic Using the Neuron Samples and select the Retry Web Service Call sample.

Setup Instructions

Before running this sample, follow these instructions:

  1. In the Visual Studio project that opens, build the solution.

Run the Sample

  1. Navigate to the Process Designer by selecting the Processes tab in the left panel of Neuron Explorer.
  2. Select the Retry Service process from the list on the left of the designer.
    Note: Maximize Neuron Explorer and drag the process to the left of the designer so that the trace message will be easier to view on the designer as the process runs.
  3. On the Process Designer toolbar click the Test button . This will open the Edit Test Message Dialog shown in Figure 3.
Figure 3: Edit Test Message dialog.
  1. Click the OK button on the Edit Test Message dialog. Once the dialog is closed the process will begin execution.
  2. As the process runs each step will be highlight in green as it is executed. As you visually follow the execution, note the sequence of steps. Also note the trace errors that are displayed in the Trace Window by the Retry step when the Service step fails to execute properly. The errors should be visible and be similar to that shown in Figure 4.
Figure 4: Neuron Process Designer Trace Window displaying failure message from the Service process step.
  1. As the process runs note that on the 3rd attempt the Service call is successful and execution of the process continues to the Trace step where the final message is displayed on the designer surface.
As an exercise try running this samples process live using the Neuron Test Client. The sample configuration file has two Parties that can be used to accomplish this. The RetrySamplePublisher Party can be used to run the process in the OnPublish mode and the TestSubscriber can be used to receive the message that came from the WCF test service.

Configuration Notes

All processes with the exception of the Code process step are configured by selecting and setting their properties in the property grid located at the bottom right of the process designer. The Code process step is configured by selecting the “Edit” option from the short cut menu that is available when right-clicking the Code step in the process designer. See the process documentation for more information.

Figure 5: The Neuron Process Designer displaying the Retry Service process. Property Grid at the bottom right displaying the properties for the Retry process step.
Was this article helpful?
Dislike 0
Previous: Splitting Messages with Join
Next: Message Validation & Transformation