Export (0) Print
Expand All

ServiceDescription Class

Provides a means of creating and formatting a valid Web Services Description Language (WSDL) document file, complete with appropriate namespaces, elements, and attributes, for describing an XML Web service. This class cannot be inherited.

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

[XmlFormatExtensionPointAttribute("Extensions")]
public sealed class ServiceDescription : NamedItem

The ServiceDescription type exposes the following members.

  NameDescription
Public methodServiceDescriptionInitializes a new instance of the ServiceDescription class.
Top

  NameDescription
Public propertyBindingsGets the collection of Binding elements contained in the ServiceDescription.
Public propertyDocumentationGets or sets the text documentation for the instance of the DocumentableItem. (Inherited from DocumentableItem.)
Public propertyDocumentationElementGets or sets the documentation element for the DocumentableItem. (Inherited from DocumentableItem.)
Public propertyExtensibleAttributesGets or sets an array of type XmlAttribute that represents attribute extensions of WSDL to comply with Web Services Interoperability (WS-I) Basic Profile 1.1. (Inherited from DocumentableItem.)
Public propertyExtensionsGets the collection of extensibility elements contained in the ServiceDescription. (Overrides DocumentableItem.Extensions.)
Public propertyImportsGets the collection of Import elements contained in the ServiceDescription.
Public propertyMessagesGets the collection of Message elements contained in the ServiceDescription.
Public propertyNameGets or sets the name of the item. (Inherited from NamedItem.)
Public propertyNamespacesGets or sets the dictionary of namespace prefixes and namespaces used to preserve namespace prefixes and namespaces when a ServiceDescription object is constructed. (Inherited from DocumentableItem.)
Public propertyPortTypesGets the collection of PortType elements contained in the ServiceDescription.
Public propertyRetrievalUrlGets or sets the URL of the XML Web service to which the ServiceDescription instance applies.
Public propertyStatic memberSchemaGets the schema associated with this ServiceDescription.
Public propertyStatic memberSerializerGets the XML serializer used to serialize and deserialize between a ServiceDescription object and a Web Services Description Language (WSDL) document.
Public propertyServiceDescriptionsGets the ServiceDescriptionCollection instance of which the ServiceDescription is a member.
Public propertyServicesGets the collection of Service instances contained in the ServiceDescription.
Public propertyTargetNamespaceGets or sets the XML targetNamespace attribute of the descriptions tag enclosing a Web Services Description Language (WSDL) file.
Public propertyTypesGets or sets the Types contained by the ServiceDescription.
Public propertyValidationWarningsGets a StringCollection that contains any validation warnings that were generated during a call to Read(Stream, Boolean), Read(TextReader, Boolean), Read(String, Boolean), or Read(XmlReader, Boolean) with the validate parameter set to true.
Top

  NameDescription
Public methodStatic memberCanReadGets a value that indicates whether an XmlReader represents a valid Web Services Description Language (WSDL) file that can be parsed.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberRead(Stream)Initializes an instance of the ServiceDescription class by directly loading the XML from a Stream instance.
Public methodStatic memberRead(String)Initializes an instance of a ServiceDescription object by directly loading the XML from the specified file.
Public methodStatic memberRead(TextReader)Initializes an instance of the ServiceDescription class by directly loading the XML from a TextReader.
Public methodStatic memberRead(XmlReader)Initializes an instance of the ServiceDescription class by directly loading the XML from an XmlReader.
Public methodStatic memberRead(Stream, Boolean)Initializes an instance of the ServiceDescription class by directly loading the XML from a Stream instance.
Public methodStatic memberRead(String, Boolean)Initializes an instance of a ServiceDescription object by directly loading the XML from the specified file.
Public methodStatic memberRead(TextReader, Boolean)Initializes an instance of the ServiceDescription class by directly loading the XML from a TextReader.
Public methodStatic memberRead(XmlReader, Boolean)Initializes an instance of the ServiceDescription class by directly loading the XML from an XmlReader.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodWrite(Stream)Writes out the ServiceDescription to the specified Stream.
Public methodWrite(String)Writes out the ServiceDescription as a Web Services Description Language (WSDL) file to the specified path.
Public methodWrite(TextWriter)Writes out the ServiceDescription as a Web Services Description Language (WSDL) file to the TextWriter.
Public methodWrite(XmlWriter)Writes out the ServiceDescription to the XmlWriter as a Web Services Description Language (WSDL) file.
Top

  NameDescription
Public fieldStatic memberNamespaceThe XML namespace in which the ServiceDescription class is defined ("http://schemas.xmlsoap.org/wsdl/"). This field is constant.
Top

Instances of this class can be created with either the new keyword or the static Read method, which parses a WSDL file and assigns its values to appropriate members of the class.

WSDL is an XML-based language for describing XML Web services. The ServiceDescription class corresponds to the root element, definitions, of a WSDL file. For more information about WSDL, see the specification at http://www.w3.org/TR/wsdl/.

The following example shows how to create an instance of the ServiceDescription class.

// Obtain the ServiceDescription of existing Wsdl.
ServiceDescription myDescription = ServiceDescription.Read("MyWsdl_CS.wsdl");
// Remove the Binding from the Binding Collection of ServiceDescription.
BindingCollection myBindingCollection = myDescription.Bindings;
myBindingCollection.Remove(myBindingCollection[0]);

// Form a new Binding.
Binding myBinding = new Binding();
myBinding.Name = "Service1Soap";
XmlQualifiedName myXmlQualifiedName = 
                     new XmlQualifiedName("s0:Service1Soap");
myBinding.Type = myXmlQualifiedName;

SoapBinding mySoapBinding = new SoapBinding();
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http";
mySoapBinding.Style = SoapBindingStyle.Document;

OperationBinding addOperationBinding = 
       CreateOperationBinding("Add",myDescription.TargetNamespace);
myBinding.Operations.Add(addOperationBinding);
myBinding.Extensions.Add(mySoapBinding);

// Add the Binding to the ServiceDescription.
myDescription.Bindings.Add(myBinding);
myDescription.Write("MyOutWsdl.wsdl");

.NET Framework

Supported in: 4.6, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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