Receive Activity Designer

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The Receive activity designer is used to create and configure a Receive activity. A Receive activity is an activity that receives a message that can be either a built-in type such as Message, Stream or XElement, or an application-defined data contract, message contract, or XML class that can be serialized.

The Receive Activity

The Receive activity can receive a single item or multiple items depending on the type of receive content used. A SendReply activity can be bound to a Receive activity that receives a message as part of a request/response message exchange pattern on the service.

Using the Receive Activity Designer

Access the Receive activity designer in the Messaging category of the Toolbox. The Receive activity designer can be dragged from the Toolbox and dropped on to the Workflow Designer surface wherever activities are usually placed. This creates a Receive activity with a default DisplayName of Receive. The DisplayName can be edited in the header of the Receive activity designer or in the DisplayName box of the property grid.

To create a SendReply activity and bind it to the selected Receive activity, right-click the Receive activity designer, click the Create SendReply item in the context menu and the SendReplyToReceive designer appears below the Receive designer. The SendReply activity is an activity that sends the reply message as part of a request/response message exchange pattern on the service. It can be configured with the SendReplyToReceive designer.

Alternatively, the ReceiveAndSendReply template designer in the Messaging category of the Toolbox can be used to create a pair of pre-configured Receive and SendReply activity. For more information about the use of the ReceiveAndSendReply and SendReplyToReceive template, see the ReceiveAndSendReply topic.

The Receive Activity Properties

The following table shows the Receive properties and describes how they are used in the designer. These properties can be edited in properties grid or on the Workflow Designer surface. The only required property is the OperationName property.

Property Name Required Usage
DisplayName False Specifies the friendly name of the Receive activity. The default value is Receive.

Although the use of a non-default value for the friendly DisplayName is not strictly required, it is a best practice to use such a value.
OperationName True Specifies the name of the service operation implemented by this Receive activity. This property is used to construct the default value for the Action property if the Action property is not explicitly set.
ServiceContractName False Specifies the name of the service contract. This property is used to group service operations into individual service contracts. All Receive activities that have the same ServiceContractName are grouped into the same service contract (WSDL Port Type). The default value is the fully qualified CLR name of the top level (root) activity.
Content False Specifies the message or parameter content to receive. It can be either a ReceiveMessageContent activity or a ReceiveParametersContent activity. Edit this property by selecting the ellipsis button beside the Content field in property grid or clicking the Define... button beside the Content label on the Receive activity designer surface. Both display the Content Definition dialog. For more information about how to use this box, see the Content Definition Dialog Box topic.
CorrelatesOn False Specifies the correlations between Receive activities in service operations of a workflow with a MessageQuerySet object. Click the ellipsis button next to the CorrelatesOn property in the properties grid to open the CorrelatesOn Definition dialog box. For more information about the use of this dialog box, see the Content Definition Dialog Box topic.
CorrelatesWith False Specifies the CorrelationHandle used to route the message to the appropriate workflow instance.

Click the ellipsis button next to the CorrelatesWith property in the properties grid to open the Expression Editor dialog box. For more information about the use of this dialog box, see the How to: Use the Expression Editor topic.
CorrelationInitializers False Specifies the collection of CorrelationInitializer objects that initialize multiple CorrelationHandle objects that configure this Receive activity within the workflow. Click the ellipsis button next to the CorrelationInitializers property in the properties grid to open the Add Correlation Initializers dialog box. For more information about using this box, see the Add CorrelationInitializers Dialog Box topic.
CanCreateInstance False Specifies a value that determines whether a new workflow instance is created to process the message if the message does not correlate to an existing workflow instance. If the value is set to true, a new workflow instance is created to process the message when the message is not correlated with an existing workflow instance.
KnownTypes False Specifies a collection of known types for the service operation implemented by this Receive activity. This property should be used in conjunction with the SerializerOption property set to DataContractSerializer. It is ignored if XmlSerializer is used.

Select the ellipsis button beside the KnownTypes field in property grid to display the Type Collection Editor dialog box with which you can add relevant types. For more information about using this box, see the Type Collection Editor Dialog Box topic.
ProtectionLevel False Specifies the ProtectionLevel for the message.

1. ProtectionLevel means authentication only.
2. ProtectionLevel means sign data to help ensure the integrity of transmitted data.
3. ProtectionLevel means encrypt and sign data to help ensure the confidentiality and integrity of transmitted data.
SerializerOption False Specifies the type of serializer to use for the service operation implemented by the Receive activity. The default value is DataContractSerializer, which serializes and deserializes an instance of a type into an XML stream or document that uses a supplied data contract. The XmlSerializer can also be used if more control is required over the XML.
Action False Specifies the action header of the message. If it is not explicitly set, its value defaults to: https://tempuri.org/{service contract namespace}/{service contract name}/{operation name}.

See also