ServiceDescription.Read 方法

定義

藉由直接載入 XML,初始化 ServiceDescription 類別的執行個體。

多載

Read(XmlReader, Boolean)

藉由從 ServiceDescription 直接載入 XML,初始化 XmlReader 類別的執行個體。

Read(String, Boolean)

藉由從指定的檔案直接載入 XML,初始化 ServiceDescription 物件的執行個體。

Read(Stream, Boolean)

藉由從 ServiceDescription 執行個體直接載入 XML,初始化 Stream 類別的執行個體。

Read(TextReader, Boolean)

藉由從 ServiceDescription 直接載入 XML,初始化 TextReader 類別的執行個體。

Read(String)

藉由從指定的檔案直接載入 XML,初始化 ServiceDescription 物件的執行個體。

Read(TextReader)

藉由從 ServiceDescription 直接載入 XML,初始化 TextReader 類別的執行個體。

Read(Stream)

藉由從 ServiceDescription 執行個體直接載入 XML,初始化 Stream 類別的執行個體。

Read(XmlReader)

藉由從 ServiceDescription 直接載入 XML,初始化 XmlReader 類別的執行個體。

Read(XmlReader, Boolean)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從 ServiceDescription 直接載入 XML,初始化 XmlReader 類別的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (System.Xml.XmlReader reader, bool validate);

參數

reader
XmlReader

以傳址方式傳遞的 XmlReader,其中包含要讀取的 XML 資料。

validate
Boolean

Boolean,指出是否應根據 Schema 指定的結構描述來驗證 XML。

傳回

ServiceDescription的執行個體。

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0

Read(String, Boolean)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從指定的檔案直接載入 XML,初始化 ServiceDescription 物件的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (string fileName, bool validate);

參數

fileName
String

要讀取的檔案路徑。

validate
Boolean

Boolean,指出是否應根據 Schema 指定的結構描述來驗證 XML。

傳回

ServiceDescription的執行個體。

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0

Read(Stream, Boolean)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從 ServiceDescription 執行個體直接載入 XML,初始化 Stream 類別的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (System.IO.Stream stream, bool validate);

參數

stream
Stream

以傳址 (By Reference) 方式傳遞的 Stream,其中包含要讀取的位元組。

validate
Boolean

Boolean,指出是否應根據 Schema 指定的結構描述來驗證 XML。

傳回

ServiceDescription的執行個體。

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0

Read(TextReader, Boolean)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從 ServiceDescription 直接載入 XML,初始化 TextReader 類別的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (System.IO.TextReader textReader, bool validate);

參數

textReader
TextReader

以傳址方式傳遞的 TextReader 執行個體,其中包含要讀取的文字。

validate
Boolean

Boolean,指出是否應根據 Schema 指定的結構描述來驗證 XML。

傳回

ServiceDescription的執行個體。

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0

Read(String)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從指定的檔案直接載入 XML,初始化 ServiceDescription 物件的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (string fileName);

參數

fileName
String

要讀取的檔案路徑。

傳回

ServiceDescription的執行個體。

範例

C#

ServiceDescription myDescription = new ServiceDescription();
myDescription = ServiceDescription.Read("MyWsdl_CS.wsdl");
myDescription.Name = "MyServiceDescription";
Console.WriteLine("Name: " + myDescription.Name);
MessageCollection myMessageCollection = myDescription.Messages;

// Remove the message at index 0 from the message collection.
myMessageCollection.Remove(myDescription.Messages[0]);

// Build a new message.
Message myMessage = new Message();
myMessage.Name = "AddSoapIn";

// Build a new MessagePart.
MessagePart myMessagePart = new MessagePart();
myMessagePart.Name = "parameters";
XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName("s0:Add");
myMessagePart.Element = myXmlQualifiedName;

// Add MessageParts to the message.
myMessage.Parts.Add(myMessagePart);

// Add the message to the ServiceDescription.
myDescription.Messages.Add(myMessage);
myDescription.Write("MyOutWsdl.wsdl");

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0

Read(TextReader)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從 ServiceDescription 直接載入 XML,初始化 TextReader 類別的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (System.IO.TextReader textReader);

參數

textReader
TextReader

以傳址方式傳遞的 TextReader 執行個體,其中包含要讀取的文字。

傳回

ServiceDescription的執行個體。

範例

C#
ServiceDescription myDescription = new ServiceDescription();

// Create a StreamReader to read a WSDL file.
TextReader myTextReader = new StreamReader("MyWsdl.wsdl");
myDescription = ServiceDescription.Read(myTextReader);
Console.WriteLine("Bindings are: ");

// Display the Bindings present in the WSDL file.
foreach(Binding myBinding in myDescription.Bindings)
{
   Console.WriteLine(myBinding.Name);
}

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0

Read(Stream)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從 ServiceDescription 執行個體直接載入 XML,初始化 Stream 類別的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (System.IO.Stream stream);

參數

stream
Stream

以傳址 (By Reference) 方式傳遞的 Stream,其中包含要讀取的位元組。

傳回

ServiceDescription的執行個體。

範例

C#
// Create a StreamReader to read a WSDL file.
StreamReader myStreamReader = new StreamReader("MyWsdl.wsdl");
ServiceDescription myDescription =
   ServiceDescription.Read(myStreamReader);
Console.WriteLine("Bindings are:");

// Display the Bindings present in the WSDL file.
foreach(Binding myBinding in myDescription.Bindings)
{
   Console.WriteLine(myBinding.Name);
}

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0

Read(XmlReader)

來源:
ServiceDescription.cs
來源:
ServiceDescription.cs
來源:
ServiceDescription.cs

藉由從 ServiceDescription 直接載入 XML,初始化 XmlReader 類別的執行個體。

C#
public static System.Web.Services.Description.ServiceDescription Read (System.Xml.XmlReader reader);

參數

reader
XmlReader

以傳址方式傳遞的 XmlReader,其中包含要讀取的 XML 資料。

傳回

ServiceDescription的執行個體。

範例

C#
// Create a new XmlTextWriter with specified URL.
XmlTextReader myXmlReader = new XmlTextReader("All_CS.wsdl");
ServiceDescription myServiceDescription =
   ServiceDescription.Read(myXmlReader);
myServiceDescription.TargetNamespace = "http://tempuri.org/";

// Remove the service named MathService.
ServiceCollection myServiceDescriptionCollection =
   myServiceDescription.Services;
myServiceDescriptionCollection.Remove(
   myServiceDescription.Services["MathService"]);

適用於

.NET Framework 4.8.1 和其他版本
產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0