本文整理汇总了VB.NET中System.Web.Services.Description.SoapFaultBinding类的典型用法代码示例。如果您正苦于以下问题:VB.NET SoapFaultBinding类的具体用法?VB.NET SoapFaultBinding怎么用?VB.NET SoapFaultBinding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoapFaultBinding类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MySoapFaultBindingSample
' 导入命名空间
Imports System.Web.Services.Description
Public Class MySoapFaultBindingSample
Public Shared Sub Main()
Try
' Input wsdl file.
Dim myInputWsdlFile As String = "SoapFaultBindingInput_vb.wsdl"
' Output wsdl file.
Dim myOutputWsdlFile As String = "SoapFaultBindingOutput_vb.wsdl"
' Initialize an instance of a 'ServiceDescription' object.
Dim myServiceDescription As ServiceDescription = ServiceDescription.Read(myInputWsdlFile)
' Get a SOAP binding object with binding name "MyService1Soap".
Dim myBinding As Binding = myServiceDescription.Bindings("MyService1Soap")
' Create a new instance of 'SoapFaultBinding' class.
Dim mySoapFaultBinding As New SoapFaultBinding()
' Encode fault message using rules specified by 'Encoding' property.
mySoapFaultBinding.Use = SoapBindingUse.Encoded
' Set the URI representing the encoding style.
mySoapFaultBinding.Encoding = "http://tempuri.org/stockquote"
' Set the URI representing the location of the specification
' for encoding of content not defined by 'Encoding' property'.
mySoapFaultBinding.Namespace = "http://tempuri.org/stockquote"
' Create a new instance of 'FaultBinding'.
Dim myFaultBinding As New FaultBinding()
myFaultBinding.Name = "AddFaultbinding"
myFaultBinding.Extensions.Add(mySoapFaultBinding)
' Get existing 'OperationBinding' object.
Dim myOperationBinding As OperationBinding = myBinding.Operations(0)
myOperationBinding.Faults.Add(myFaultBinding)
' Create a new wsdl file.
myServiceDescription.Write(myOutputWsdlFile)
Console.WriteLine("The new wsdl file created is :" + myOutputWsdlFile)
Console.WriteLine("Proxy could be created using command : wsdl /language:VB " + myOutputWsdlFile)
Catch e As Exception
Console.WriteLine("Error occurred : " + e.Message.ToString())
End Try
End Sub
End Class