本文整理汇总了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