ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 292
نمايش فراداده

ServiceDescription

System.Web.Services.Description (system.web.services.dll)sealed class

The ServiceDescription class represents a valid WSDL document, complete with appropriate namespaces, elements, and attributes. The elements of the WSDL file are all represented by other, distinct classes in the System.Web.Services.Description namespace, and provided through the properties of the ServiceDescription class. At the top level, a WSDL document contains a series of definitions in a <definitions> element. These definitions define Types, Message, PortType, Binding, and Service elements.

The ServiceDescription class also provides a Read( ) and Write( ) method. Both methods are overloaded to allow you to serialize information to or from a System.IO.Stream, a System.IO.TextReader, a System.IO.TextWriter, a System.Xml.XmlReader, a System.Xml.XmlWriter, or a string containing a fully qualified path and filename.

There are three ways to create a ServiceDescription object. You can use the New keyword and create one manually, you can use the ServiceDescriptionReflector to create one from a live web service, or you can use the shared Read( ) method to create one from a WSDL file. For example, you can create a ServiceDescription object, with all its subobjects fully populated by using a syntax like MyServiceDesc = ServiceDescription.Read("MyFile.xml");.

public sealed class 

ServiceDescription : DocumentableItem { // Public Constructors public

ServiceDescription ( ); // Public Static Fields public const string

Namespace ; // =http://schemas.xmlsoap.org/wsdl/ // Public Static Properties public static XmlSerializer

Serializer {get; } // Public Instance Properties public BindingCollection

Bindings {get; } public ServiceDescriptionFormatExtensionCollection

Extensions {get; } public ImportCollection

Imports {get; } public MessageCollection

Messages {get; } public string

Name {set; get; } public PortTypeCollection

PortTypes {get; } public string

RetrievalUrl {set; get; } public ServiceDescriptionCollection

ServiceDescriptions {get; } public ServiceCollection

Services {get; } public string

TargetNamespace {set; get; } public Types

Types {set; get; } // Public Static Methods public static bool

CanRead (System.Xml.XmlReader

reader ); public static ServiceDescription

Read (System.IO.Stream

stream ); public static ServiceDescription

Read (string

fileName ); public static ServiceDescription

Read (System.IO.TextReader

textReader ); public static ServiceDescription

Read (System.Xml.XmlReader

reader ); // Public Instance Methods public void

Write (System.IO.Stream

stream ); public void

Write (string

fileName ); public void

Write (System.IO.TextWriter

writer ); public void

Write (System.Xml.XmlWriter

writer ); }

Hierarchy

System.Object DocumentableItem ServiceDescription

Returned By

Binding.ServiceDescription, Import.ServiceDescription, Message.ServiceDescription, PortType.ServiceDescription, ProtocolReflector.{GetServiceDescription( ), ServiceDescription}, Service.ServiceDescription, ServiceDescriptionCollection.this, System.Web.Services.Discovery.ContractReference.Contract

Passed To

ServiceDescriptionCollection.{Add( ), Contains( ), CopyTo( ), IndexOf( ), Insert( ), Remove( ), this}, ServiceDescriptionImporter.AddServiceDescription( )