本文整理汇总了VB.NET中System.Web.Services.Description.OperationCollection类的典型用法代码示例。如果您正苦于以下问题:VB.NET OperationCollection类的具体用法?VB.NET OperationCollection怎么用?VB.NET OperationCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OperationCollection类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyOperationCollectionSample
Option Strict On
Imports System.Web.Services
Imports System.Xml
Imports System.Web.Services.Description
Class MyOperationCollectionSample
Public Shared Sub Main()
Try
' Read the 'MathService_Input_vb.wsdl' file.
Dim myDescription As ServiceDescription = _
ServiceDescription.Read("MathService_Input_vb.wsdl")
Dim myPortTypeCollection As PortTypeCollection = _
myDescription.PortTypes
' Get the 'OperationCollection' for 'SOAP' protocol.
Dim myOperationCollection As OperationCollection = _
myPortTypeCollection(0).Operations
Dim myOperation As New Operation()
myOperation.Name = "Add"
Dim myOperationMessageInput As OperationMessage = _
CType(New OperationInput(), OperationMessage)
myOperationMessageInput.Message = New XmlQualifiedName _
("AddSoapIn", myDescription.TargetNamespace)
Dim myOperationMessageOutput As OperationMessage = _
CType(New OperationOutput(), OperationMessage)
myOperationMessageOutput.Message = New XmlQualifiedName _
("AddSoapOut", myDescription.TargetNamespace)
myOperation.Messages.Add(myOperationMessageInput)
myOperation.Messages.Add(myOperationMessageOutput)
myOperationCollection.Add(myOperation)
If myOperationCollection.Contains(myOperation) = True Then
Console.WriteLine("The index of the added 'myOperation' " + _
"operation is : " + _
myOperationCollection.IndexOf(myOperation).ToString)
End If
myOperationCollection.Remove(myOperation)
' Insert the 'myOpearation' operation at the index '0'.
myOperationCollection.Insert(0, myOperation)
Console.WriteLine("The operation at index '0' is : " + _
myOperationCollection.Item(0).Name)
Dim myOperationArray(myOperationCollection.Count) As Operation
myOperationCollection.CopyTo(myOperationArray, 0)
Console.WriteLine("The operation(s) in the collection are :")
Dim i As Integer
For i = 0 To myOperationCollection.Count - 1
Console.WriteLine(" " + myOperationArray(i).Name)
Next i
myDescription.Write("MathService_New_vb.wsdl")
Catch e As Exception
Console.WriteLine("Exception caught!!!")
Console.WriteLine("Source : " + e.Source)
Console.WriteLine("Message : " + e.Message)
End Try
End Sub
End Class