本文整理汇总了VB.NET中System.Web.Services.Description.MessageBinding类的典型用法代码示例。如果您正苦于以下问题:VB.NET MessageBinding类的具体用法?VB.NET MessageBinding怎么用?VB.NET MessageBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MessageBinding类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: MyClass1
' 导入命名空间
Imports System.Web.Services.Description
Class MyClass1
Public Shared Sub Main()
Dim addOperationBinding As OperationBinding = _
CreateOperationBinding("Add", "http://tempuri.org/")
End Sub
Public Shared Function CreateInputOutputBinding(myBindName As String, _
isInputBinding As Boolean) As MessageBinding
' Value isInputBinding = true ---> return type = InputBinding.
' Value isInputBinding = false --> return type = OutputBinding.
Dim myMessageBinding As MessageBinding = Nothing
Select Case isInputBinding
Case True
myMessageBinding = New InputBinding()
Console.WriteLine("Added an InputBinding")
Case False
myMessageBinding = New OutputBinding()
Console.WriteLine("Added an OutputBinding")
End Select
myMessageBinding.Name = myBindName
Dim mySoapBodyBinding As New SoapBodyBinding()
mySoapBodyBinding.Use = SoapBindingUse.Literal
myMessageBinding.Extensions.Add(mySoapBodyBinding)
Console.WriteLine("Added extensibility element of type: " & _
mySoapBodyBinding.GetType().ToString())
Return myMessageBinding
End Function 'CreateInputOutputBinding
' Used to create OperationBinding instances within Binding.
Public Shared Function CreateOperationBinding(myOperation As String, _
targetNamespace As String) As OperationBinding
' Create OperationBinding for operation.
Dim myOperationBinding As New OperationBinding()
myOperationBinding.Name = myOperation
' Create InputBinding for operation.
Dim myInputBinding As InputBinding = _
CType(CreateInputOutputBinding(Nothing, True), InputBinding)
' Create OutputBinding for operation.
Dim myOutputBinding As OutputBinding = _
CType(CreateInputOutputBinding(Nothing, False), OutputBinding)
' Add InputBinding and OutputBinding to OperationBinding.
myOperationBinding.Input = myInputBinding
myOperationBinding.Output = myOutputBinding
' Create an extensibility element for SoapOperationBinding.
Dim mySoapOperationBinding As New SoapOperationBinding()
mySoapOperationBinding.Style = SoapBindingStyle.Document
mySoapOperationBinding.SoapAction = targetNamespace + myOperation
' Add the extensibility element SoapOperationBinding to OperationBinding.
myOperationBinding.Extensions.Add(mySoapOperationBinding)
Return myOperationBinding
End Function 'CreateOperationBinding
End Class
开发者ID:VB.NET开发者,项目名称:System.Web.Services.Description,代码行数:61,代码来源:MessageBinding
注:本文中的System.Web.Services.Description.MessageBinding类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论