Modeling WCF message contracts

You can model a Windows Communication Foundation (WCF) message contract.

Before you begin

To use the stereotypes required in this procedure, you must apply the .Net WCF profile to the model. The C# transformation profile is optional for creating C# structs.

About this task

To model a WCF message contract in a diagram:

Procedure

  1. Add a UML class in the diagram.
  2. Apply the «Message Contract» stereotype to the class. Optionally, to create a C# struct, also apply the «CSharp Struct» stereotype to the class.
  3. On the Stereotypes page of the Properties view, under Stereotype Properties, set the message contract properties as required for your implementation.
  4. In the class, add one or more UML attributes.
  5. To each attribute you generate into the Simple Object Access Protocol (SOAP) header of the message, apply the «Message Header» stereotype.
  6. To each attribute you generate into the SOAP body of the message, apply the «Message Body Member» stereotype.

Example

The following image shows a sample diagram of a message contract.
Diagram view of a WCF message contract.

What to do next

After modeling the message contract, you can configure and run a UML-to-C# transformation to generate the C# code.

Feedback