Düzenle

Aracılığıyla paylaş


ServiceDescription Class

Definition

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.

public ref class ServiceDescription sealed : System::Web::Services::Description::DocumentableItem
public ref class ServiceDescription sealed : System::Web::Services::Description::NamedItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class ServiceDescription : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class ServiceDescription : System.Web.Services.Description.NamedItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type ServiceDescription = class
    inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type ServiceDescription = class
    inherit NamedItem
Public NotInheritable Class ServiceDescription
Inherits DocumentableItem
Public NotInheritable Class ServiceDescription
Inherits NamedItem
Inheritance
ServiceDescription
Inheritance
ServiceDescription
Attributes

Examples

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 = gcnew Binding;
myBinding->Name = "Service1Soap";
XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" );
myBinding->Type = myXmlQualifiedName;
SoapBinding^ mySoapBinding = gcnew 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" );
// 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");
' Obtain the ServiceDescription of existing Wsdl.
Dim myDescription As ServiceDescription = ServiceDescription.Read("MyWsdl_VB.wsdl")
' Remove the Binding from the Binding Collection of ServiceDescription.
Dim myBindingCollection As BindingCollection = myDescription.Bindings
myBindingCollection.Remove(myBindingCollection(0))

' Form a new Binding.
Dim myBinding As New Binding()
myBinding.Name = "Service1Soap"
Dim myXmlQualifiedName As New XmlQualifiedName("s0:Service1Soap")
myBinding.Type = myXmlQualifiedName

Dim mySoapBinding As New SoapBinding()
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http"
mySoapBinding.Style = SoapBindingStyle.Document

Dim addOperationBinding As OperationBinding = 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")

Remarks

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 WSDL specification.

Constructors

ServiceDescription()

Initializes a new instance of the ServiceDescription class.

Fields

Namespace

The XML namespace in which the ServiceDescription class is defined ("http://schemas.xmlsoap.org/wsdl/"). This field is constant.

Properties

Bindings

Gets the collection of Binding elements contained in the ServiceDescription.

Documentation

Gets or sets the text documentation for the instance of the DocumentableItem.

(Inherited from DocumentableItem)
DocumentationElement

Gets or sets the documentation element for the DocumentableItem.

(Inherited from DocumentableItem)
ExtensibleAttributes

Gets 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)
Extensions

Gets the collection of extensibility elements contained in the ServiceDescription.

Imports

Gets the collection of Import elements contained in the ServiceDescription.

Messages

Gets the collection of Message elements contained in the ServiceDescription.

Name

Gets or sets the XML name attribute of the descriptions tag enclosing the Web Services Description Language (WSDL) file.

Name

Gets or sets the name of the item.

(Inherited from NamedItem)
Namespaces

Gets 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)
PortTypes

Gets the collection of PortType elements contained in the ServiceDescription.

RetrievalUrl

Gets or sets the URL of the XML Web service to which the ServiceDescription instance applies.

Schema

Gets the schema associated with this ServiceDescription.

Serializer

Gets the XML serializer used to serialize and deserialize between a ServiceDescription object and a Web Services Description Language (WSDL) document.

ServiceDescriptions

Gets the ServiceDescriptionCollection instance of which the ServiceDescription is a member.

Services

Gets the collection of Service instances contained in the ServiceDescription.

TargetNamespace

Gets or sets the XML targetNamespace attribute of the descriptions tag enclosing a Web Services Description Language (WSDL) file.

Types

Gets or sets the Types contained by the ServiceDescription.

ValidationWarnings

Gets 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.

Methods

CanRead(XmlReader)

Gets a value that indicates whether an XmlReader represents a valid Web Services Description Language (WSDL) file that can be parsed.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Read(Stream, Boolean)

Initializes an instance of the ServiceDescription class by directly loading the XML from a Stream instance.

Read(Stream)

Initializes an instance of the ServiceDescription class by directly loading the XML from a Stream instance.

Read(String, Boolean)

Initializes an instance of a ServiceDescription object by directly loading the XML from the specified file.

Read(String)

Initializes an instance of a ServiceDescription object by directly loading the XML from the specified file.

Read(TextReader, Boolean)

Initializes an instance of the ServiceDescription class by directly loading the XML from a TextReader.

Read(TextReader)

Initializes an instance of the ServiceDescription class by directly loading the XML from a TextReader.

Read(XmlReader, Boolean)

Initializes an instance of the ServiceDescription class by directly loading the XML from an XmlReader.

Read(XmlReader)

Initializes an instance of the ServiceDescription class by directly loading the XML from an XmlReader.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
Write(Stream)

Writes out the ServiceDescription to the specified Stream.

Write(String)

Writes out the ServiceDescription as a Web Services Description Language (WSDL) file to the specified path.

Write(TextWriter)

Writes out the ServiceDescription as a Web Services Description Language (WSDL) file to the TextWriter.

Write(XmlWriter)

Writes out the ServiceDescription to the XmlWriter as a Web Services Description Language (WSDL) file.

Applies to