当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET ServiceDescription.PortTypes属性代码示例

本文整理汇总了VB.NET中System.Web.Services.Description.ServiceDescription.PortTypes属性的典型用法代码示例。如果您正苦于以下问题:VB.NET ServiceDescription.PortTypes属性的具体用法?VB.NET ServiceDescription.PortTypes怎么用?VB.NET ServiceDescription.PortTypes使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Web.Services.Description.ServiceDescription的用法示例。


在下文中一共展示了ServiceDescription.PortTypes属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: Main

Shared Sub Main()
   Dim myWsdlFileName As String = "MyWsdl_VB.wsdl"
   Dim myReader As New XmlTextReader(myWsdlFileName)
   If ServiceDescription.CanRead(myReader) Then
      
      Dim myDescription As ServiceDescription = _
         ServiceDescription.Read(myWsdlFileName)

      ' Remove the PortType at index 0 of the collection.
      Dim myPortTypeCollection As PortTypeCollection = _
         myDescription.PortTypes
      myPortTypeCollection.Remove(myDescription.PortTypes(0))

      ' Build a new PortType.
      Dim myPortType As New PortType()
      myPortType.Name = "Service1Soap"
      Dim myOperation As Operation = _
         CreateOperation("Add", "s0:AddSoapIn", "s0:AddSoapOut", "")
      myPortType.Operations.Add(myOperation)

      ' Add a new PortType to the PortType collection of 
      ' the ServiceDescription.
      myDescription.PortTypes.Add(myPortType)
      
      myDescription.Write("MyOutWsdl.wsdl")
      Console.WriteLine("New WSDL file generated successfully.")
   Else
      Console.WriteLine("This file is not a WSDL file.")
   End If
End Sub
 
' Creates an Operation for a PortType.
Public Shared Function CreateOperation(operationName As String, _
   inputMessage As String, outputMessage As String, _
   targetNamespace As String) As Operation

   Dim myOperation As New Operation()
   myOperation.Name = operationName
   Dim input As OperationMessage = _
      CType(New OperationInput(), OperationMessage)
   input.Message = New XmlQualifiedName(inputMessage, targetNamespace)
   Dim output As OperationMessage = _
      CType(New OperationOutput(), OperationMessage)
   output.Message = New XmlQualifiedName(outputMessage, targetNamespace)
   myOperation.Messages.Add(input)
   myOperation.Messages.Add(output)
   Return myOperation
End Function 'CreateOperation
开发者ID:VB.NET开发者,项目名称:System.Web.Services.Description,代码行数:48,代码来源:ServiceDescription.PortTypes


注:本文中的System.Web.Services.Description.ServiceDescription.PortTypes属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。