本文整理匯總了VB.NET中System.Web.Services.Description.PortTypeCollection類的典型用法代碼示例。如果您正苦於以下問題:VB.NET PortTypeCollection類的具體用法?VB.NET PortTypeCollection怎麽用?VB.NET PortTypeCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了PortTypeCollection類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyPortTypeCollectionClass
' 導入命名空間
Imports System.Web.Services.Description
Imports System.Xml
Imports System.Collections
Class MyPortTypeCollectionClass
Public Shared Sub Main()
Try
' Read the existing Web service description file.
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("MathService_vb.wsdl")
Dim myPortTypeCollection As PortTypeCollection = _
myServiceDescription.PortTypes
Dim noOfPortTypes As Integer = _
myServiceDescription.PortTypes.Count
Console.WriteLine( _
ControlChars.Newline & "Total number of PortTypes: " & _
myServiceDescription.PortTypes.Count.ToString())
' Get the first PortType in the collection.
Dim myNewPortType As PortType = _
myPortTypeCollection("MathServiceSoap")
Dim index As Integer = myPortTypeCollection.IndexOf(myNewPortType)
Console.WriteLine("The PortType with the name " & _
myNewPortType.Name & " is at index: " & (index + 1).ToString())
Console.WriteLine("Removing the PortType: " & myNewPortType.Name)
' Remove the PortType from the collection.
myPortTypeCollection.Remove(myNewPortType)
Dim bContains As Boolean = _
myPortTypeCollection.Contains(myNewPortType)
Console.WriteLine("The PortType with the Name " & _
myNewPortType.Name & " exists: " & bContains.ToString())
Console.WriteLine("Total Number of PortTypes after removing: " & _
myServiceDescription.PortTypes.Count.ToString())
Console.WriteLine("Adding a PortType: " & myNewPortType.Name)
' Add a new portType from the collection.
myPortTypeCollection.Add(myNewPortType)
' Display the number of portTypes after adding a port.
Console.WriteLine( _
"Total Number of PortTypes after adding a new port: " & _
myServiceDescription.PortTypes.Count.ToString())
' List the PortTypes available in the WSDL document.
Dim myPortType As PortType
For Each myPortType In myPortTypeCollection
Console.WriteLine("The PortType name is: " & myPortType.Name)
Next myPortType
myServiceDescription.Write("MathService_New.wsdl")
Catch e As Exception
Console.WriteLine("Exception: " & e.Message)
End Try
End Sub
End Class