Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

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)
public sealed class ServiceDescription : NamedItem
public final class ServiceDescription extends NamedItem
public final class ServiceDescription extends NamedItem
Not applicable.

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");

// Obtain the ServiceDescription of existing Wsdl.
ServiceDescription myDescription = ServiceDescription.
    Read("MyWsdl_JSL.wsdl");
// Remove the Binding from the Binding Collection of 
// ServiceDescription.
BindingCollection myBindingCollection = myDescription.
    get_Bindings();
myBindingCollection.Remove(myBindingCollection.get_Item(0));
// Form a new Binding.
Binding myBinding = new Binding();
myBinding.set_Name("Service1Soap");
XmlQualifiedName myXmlQualifiedName = new 
    XmlQualifiedName("s0:Service1Soap");
myBinding.set_Type(myXmlQualifiedName);

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

OperationBinding addOperationBinding = CreateOperationBinding("Add",
    myDescription.get_TargetNamespace());
myBinding.get_Operations().Add(addOperationBinding);
myBinding.get_Extensions().Add(mySoapBinding);
// Add the Binding to the ServiceDescription.
myDescription.get_Bindings().Add(myBinding);
myDescription.Write("MyOutWsdl.wsdl");

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

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.