本文整理匯總了VB.NET中System.Web.Services.Discovery.ContractReference類的典型用法代碼示例。如果您正苦於以下問題:VB.NET ContractReference類的具體用法?VB.NET ContractReference怎麽用?VB.NET ContractReference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ContractReference類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyContractReference
' 導入命名空間
Imports System.Xml
Imports System.IO
Imports System.Web.Services.Discovery
Public Class MyContractReference
Shared Sub Main()
Try
' Get a 'DiscoveryDocument' object.
Dim myDiscoveryDocument As New DiscoveryDocument()
' Get a 'ContractReference' object.
Dim myContractReference As New ContractReference()
' Set the URL to the referenced service description.
myContractReference.Ref = "http://localhost/service1.asmx?wsdl"
' Set the URL for a XML Web service implementing the service
' description .
myContractReference.DocRef = "http://localhost/service1.asmx"
Dim myBinding As New SoapBinding()
myBinding.Binding = New XmlQualifiedName("q1:Service1Soap")
myBinding.Address = "http://localhost/service1.asmx"
' Add 'myContractReference' to the list of references contained
' within the discovery document.
myDiscoveryDocument.References.Add(myContractReference)
' Add 'Binding' to referenceCollection.
myDiscoveryDocument.References.Add(myBinding)
' Open or create a file for writing .
Dim myFileStream As New FileStream("Service1.disco", FileMode.OpenOrCreate, FileAccess.Write)
Dim myStreamWriter As New StreamWriter(myFileStream)
' Write 'myDiscoveryDocument' into the passed stream.
myDiscoveryDocument.Write(myStreamWriter)
Console.WriteLine("The 'Service1.disco' is generated.")
Catch e As Exception
Console.WriteLine("Error is" + e.Message)
End Try
End Sub
End Class