本文整理汇总了VB.NET中System.Web.Services.Description.SoapHeaderBinding类的典型用法代码示例。如果您正苦于以下问题:VB.NET SoapHeaderBinding类的具体用法?VB.NET SoapHeaderBinding怎么用?VB.NET SoapHeaderBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoapHeaderBinding类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MySampleClass
' 导入命名空间
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml
Public Class MySampleClass
Public Shared Sub Main()
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("SoapHeaderBindingInput_vb.wsdl")
Dim myBinding As New Binding()
myBinding.Name = "MyWebServiceSoap"
myBinding.Type = New XmlQualifiedName("s0:MyWebServiceSoap")
Dim mySoapBinding As New SoapBinding()
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http"
mySoapBinding.Style = SoapBindingStyle.Document
myBinding.Extensions.Add(mySoapBinding)
Dim myOperationBinding As New OperationBinding()
myOperationBinding.Name = "Hello"
Dim mySoapOperationBinding As New SoapOperationBinding()
mySoapOperationBinding.SoapAction = "http://tempuri.org/Hello"
mySoapOperationBinding.Style = SoapBindingStyle.Document
myOperationBinding.Extensions.Add(mySoapOperationBinding)
' Create InputBinding for operation for the 'SOAP' protocol.
Dim myInputBinding As New InputBinding()
Dim mySoapBodyBinding As New SoapBodyBinding()
mySoapBodyBinding.Use = SoapBindingUse.Literal
myInputBinding.Extensions.Add(mySoapBodyBinding)
Dim mySoapHeaderBinding As New SoapHeaderBinding()
mySoapHeaderBinding.Message = New XmlQualifiedName("s0:HelloMyHeader")
mySoapHeaderBinding.Part = "MyHeader"
mySoapHeaderBinding.Use = SoapBindingUse.Literal
' Add mySoapHeaderBinding to 'myInputBinding' object.
myInputBinding.Extensions.Add(mySoapHeaderBinding)
' Create OutputBinding for operation for the 'SOAP' protocol.
Dim myOutputBinding As New OutputBinding()
myOutputBinding.Extensions.Add(mySoapBodyBinding)
' Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding
myOperationBinding.Output = myOutputBinding
myBinding.Operations.Add(myOperationBinding)
myServiceDescription.Bindings.Add(myBinding)
myServiceDescription.Write("SoapHeaderBindingOut_vb.wsdl")
Console.WriteLine("'SoapHeaderBindingOut_vb.wsdl' file is generated.")
Console.WriteLine("Proxy could be created using " + _
"'wsdl /language:VB SoapHeaderBindingOut_vb.wsdl'.")
End Sub
End Class