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.

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

System.Object
   System.Web.Services.Description.DocumentableItem
      System.Web.Services.Description.ServiceDescription

[Visual Basic]
NotInheritable Public Class ServiceDescription
   Inherits DocumentableItem
[C#]
public sealed class ServiceDescription : DocumentableItem
[C++]
public __gc __sealed class ServiceDescription : public
   DocumentableItem
[JScript]
public class ServiceDescription 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.

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 specification at http://www.w3.org/TR/wsdl/.

Example

[Visual Basic, C#, C++] The following example shows how to create an instance of the ServiceDescription class.

[Visual Basic] 
' 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")

[C#] 
// 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");

[C++] 
// Obtain the ServiceDescription of existing Wsdl.
ServiceDescription* myDescription = ServiceDescription::Read(S"MyWsdl_CS.wsdl");
// Remove the Binding from the Binding Collection of ServiceDescription.
BindingCollection* myBindingCollection = myDescription->Bindings;
myBindingCollection->Remove(myBindingCollection->Item[0]);

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

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

OperationBinding* addOperationBinding = 
   CreateOperationBinding(S"Add",myDescription->TargetNamespace);
myBinding->Operations->Add(addOperationBinding);
myBinding->Extensions->Add(mySoapBinding);

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

[Visual Basic, C#, C++]

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

Requirements

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

ServiceDescription Members | System.Web.Services.Description Namespace

Show:
© 2014 Microsoft