本文整理汇总了VB.NET中System.Web.Services.Discovery.DiscoveryReference类的典型用法代码示例。如果您正苦于以下问题:VB.NET DiscoveryReference类的具体用法?VB.NET DiscoveryReference怎么用?VB.NET DiscoveryReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DiscoveryReference类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: MyDiscoveryDocumentClass
' 导入命名空间
Imports System.IO
Imports System.Web.Services.Discovery
Imports System.Net
Class MyDiscoveryDocumentClass
Public Shared Sub Main()
Try
Dim myDiscoveryDocument As DiscoveryDocument
Dim myStreamReader As New StreamReader("c:\Inetpub\wwwroot\dataservice.disco")
Dim myStream As New FileStream("c:\MyDiscovery.disco", FileMode.OpenOrCreate)
Console.WriteLine("Demonstrating DiscoveryReference class.")
' Read the discovery file.
myDiscoveryDocument = DiscoveryDocument.Read(myStreamReader)
' Create an instance of the DiscoveryReference class.
Dim myDiscoveryReference As MyDiscoveryReferenceClass
myDiscoveryReference = New MyDiscoveryReferenceClass()
Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()
myDiscoveryClientProtocol.Credentials = _
CredentialCache.DefaultCredentials
' Set the client protocol.
myDiscoveryReference.ClientProtocol = myDiscoveryClientProtocol
' Read the default file name.
Console.WriteLine("Default file name is: " _
& myDiscoveryReference.DefaultFilename)
' Write the document.
myDiscoveryReference.WriteDocument(myDiscoveryDocument, myStream)
' Read the document.
myDiscoveryReference.ReadDocument(myStream)
' Set the URL.
myDiscoveryReference.Url = "http://localhost/dataservice.disco"
Console.WriteLine("Url is : " + myDiscoveryReference.Url)
' Resolve the URL.
myDiscoveryReference.Resolve()
myStreamReader.Close()
myStream.Close()
Catch e as Exception
Console.WriteLine("Exception caught! - {0}", e.Message)
End Try
End Sub
End Class
' Class derived from DiscoveryReference class and overriding it members.
Class MyDiscoveryReferenceClass
Inherits DiscoveryReference
Private myDocumentUrl As String
Public Overrides ReadOnly Property DefaultFilename() As String
Get
Return "dataservice.disco"
End Get
End Property
Public Overrides Function _
ReadDocument(ByVal stream As System.IO.Stream) As Object
Return stream
End Function
Public Overloads Sub Resolve()
Try
Dim myDiscoveryRefDocument As DiscoveryDocument
myDiscoveryRefDocument = MyBase.ClientProtocol.Discover(Url)
Catch e As Exception
Throw e
End Try
End Sub
Protected Overloads Overrides Sub _
Resolve(ByVal contentType As String, ByVal stream As Stream)
End Sub
Public Overrides Property Url() As String
Get
Return myDocumentUrl
End Get
Set(ByVal Value As String)
myDocumentUrl = Value
End Set
End Property
Public Overrides Sub WriteDocument _
(ByVal document As Object, ByVal stream As System.IO.Stream)
Dim myDiscoveryDocument As DiscoveryDocument = _
CType(document, DiscoveryDocument)
myDiscoveryDocument.Write(stream)
End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System.Web.Services.Discovery,代码行数:102,代码来源:DiscoveryReference
注:本文中的System.Web.Services.Discovery.DiscoveryReference类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论