本文整理匯總了VB.NET中System.Web.Services.Description.OperationFault類的典型用法代碼示例。如果您正苦於以下問題:VB.NET OperationFault類的具體用法?VB.NET OperationFault怎麽用?VB.NET OperationFault使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了OperationFault類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyOperationFaultSample
' 導入命名空間
Imports System.Web.Services.Description
Imports System.Xml
Imports System.Xml.Schema
Imports System.Xml.Serialization
Public Class MyOperationFaultSample
Public Shared Sub Main()
Try
' Read the 'StockQuote_vb.wsdl' file as input.
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("StockQuote_vb.wsdl")
Dim myPortTypeCollection As PortTypeCollection = _
myServiceDescription.PortTypes
Dim myPortType As PortType = myPortTypeCollection(0)
Dim myOperationCollection As OperationCollection = myPortType.Operations
Dim myOperation As Operation = myOperationCollection(0)
Dim myOperationFault As New OperationFault()
myOperationFault.Name = "ErrorString"
myOperationFault.Message = _
New XmlQualifiedName("s0:GetTradePriceStringFault")
myOperation.Faults.Add(myOperationFault)
Console.WriteLine("Added OperationFault with Name: " + _
myOperationFault.Name)
myOperationFault = New OperationFault()
myOperationFault.Name = "ErrorInt"
myOperationFault.Message = _
New XmlQualifiedName("s0:GetTradePriceIntFault")
myOperation.Faults.Add(myOperationFault)
myOperationCollection.Add(myOperation)
Console.WriteLine("Added Second OperationFault with Name: " + _
myOperationFault.Name)
myServiceDescription.Write("StockQuoteNew_vb.wsdl")
Console.WriteLine(ControlChars.NewLine + _
"The file 'StockQuoteNew_vb.wsdl' is " + _
"created successfully.")
Catch e As Exception
Console.WriteLine("Exception caught!!!")
Console.WriteLine("Source : " + e.Source)
Console.WriteLine("Message : " + e.Message)
End Try
End Sub
End Class