本文整理匯總了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