本文整理汇总了VB.NET中System.Web.Services.Description.Import类的典型用法代码示例。如果您正苦于以下问题:VB.NET Import类的具体用法?VB.NET Import怎么用?VB.NET Import使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Import类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MySample
' 导入命名空间
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml
Class MySample
Public Shared Sub Main()
Console.WriteLine("Import Sample")
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("StockQuote_vb.wsdl")
myServiceDescription.Imports.Add( _
CreateImport("http://localhost/stockquote/schemas", _
"http://localhost/stockquote/stockquote_vb.xsd"))
' Save the ServiceDescripition to an external file.
myServiceDescription.Write("StockQuote_vb.wsdl")
Console.WriteLine("Successfully added Import to WSDL document " _
& "'StockQuote_vb.wsdl'")
' Print the import collection to the console.
PrintImportCollection("StockQuote_vb.wsdl")
myServiceDescription = _
ServiceDescription.Read("StockQuoteService_vb.wsdl")
myServiceDescription.Imports.Insert(0, _
CreateImport("http://localhost/stockquote/definitions", _
"http://localhost/stockquote/stockquote_vb.wsdl"))
' Save the ServiceDescripition to an external file.
myServiceDescription.Write("StockQuoteService_vb.wsdl")
Console.WriteLine("")
Console.WriteLine("Successfully added Import to " & _
"WSDL document 'StockQuoteService_vb.wsdl'")
'Print the import collection to the console.
PrintImportCollection("StockQuoteService_vb.wsdl")
End Sub
' Creates an Import object with namespace and location.
Public Shared Function CreateImport(targetNamespace As String, _
targetlocation As String) As Import
Dim myImport As New Import()
myImport.Location = targetlocation
myImport.Namespace = targetNamespace
Return myImport
End Function 'CreateImport
Public Shared Sub PrintImportCollection(fileName_wsdl As String)
' Read import collection properties from generated WSDL file.
Dim myServiceDescription1 As _
ServiceDescription = ServiceDescription.Read(fileName_wsdl)
Dim myImportCollection As ImportCollection = myServiceDescription1.Imports
Console.WriteLine("Enumerating Import Collection for file '" & _
fileName_wsdl & "'...")
' Print Import properties to the console.
Dim i As Integer
For i = 0 To myImportCollection.Count - 1
Console.WriteLine("Namespace : " & myImportCollection(i).Namespace)
Console.WriteLine("Location : " & myImportCollection(i).Location)
Console.WriteLine("ServiceDescription : " & _
myImportCollection(i).ServiceDescription.Name)
Next i
End Sub
End Class