This documentation is archived and is not being maintained.

Message Class

Provides an abstract definition of data passed by an XML Web service. This class cannot be inherited.

For a list of all members of this type, see Message Members.


[Visual Basic]
NotInheritable Public Class Message
   Inherits DocumentableItem
public sealed class Message : DocumentableItem
public __gc __sealed class Message : public DocumentableItem
public class Message extends DocumentableItem

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


A Message can contain either document-oriented or procedure-oriented information. Procedure-oriented messages contain parameters and return values, while document-oriented messages contain documents.

The Message class corresponds to a Web Services Description Language (WSDL) <message> element enclosed by the <definitions> root element. For more information about WSDL, see the specification at


[Visual Basic] 
' Creates a Message with name = messageName having one MessagePart 
' with name = partName.
Public Shared Function CreateMessage(messageName As String, _
   partName As String, element As String, targetNamespace As String) _
   As Message
   Dim myMessage As New Message()
   myMessage.Name = messageName
   Dim myMessagePart As New MessagePart()
   myMessagePart.Name = partName
   myMessagePart.Element = New XmlQualifiedName(element, targetNamespace)
   Return myMessage
End Function 'CreateMessage

// Creates a Message with name = messageName having one MessagePart 
// with name = partName.
public static Message CreateMessage(string messageName,string partName,
   string element,string targetNamespace)
   Message myMessage = new Message();
   myMessage.Name = messageName;
   MessagePart myMessagePart = new MessagePart();
   myMessagePart.Name = partName;
   myMessagePart.Element = new XmlQualifiedName(element,targetNamespace);
   return myMessage;

// Creates a Message with name = messageName having one MessagePart
// with name = partName.
static Message* CreateMessage(String* messageName,String* partName,
   String* element,String* targetNamespace)
   Message* myMessage = new Message();
   myMessage->Name = messageName;
   MessagePart* myMessagePart = new MessagePart();
   myMessagePart->Name = partName;
   myMessagePart->Element = new XmlQualifiedName(element,targetNamespace);
   return myMessage;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Web.Services.Description

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web.Services (in System.Web.Services.dll)

See Also

Message Members | System.Web.Services.Description Namespace