本文整理汇总了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