Didn't know where else to put this one. I'm a newbie with webservices and VB.net in general. I'm using VWD Express and this is a learning excercise I've created for myself but I'm running into problems. I've created a web service IO.asmx that handles the webservices "low-level API" (i.e. the changing of an xml file) and another called Menu.asmx that uses the classes defined in IO.asmx.
Here's what I have:
In IO.asmx
<WebMethod()> _
Public Function LoadXML(ByVal sFileName As String, _
ByVal asFields() As String) As Data.DataSet
Dim oDataSet As Data.DataSet = CreateTableStruct(sFileName, asFields)
oDataSet.ReadXml("c:/website/XMLStorage/XML/" & sFileName & ".xml")
Return oDataSet
End Function
In Menu.asmx
<WebMethod()> _
Public Function GetMenu() As Data.DataSet
'Create instance of IO web service
Dim oIO As New localhost.IO()
'Create a DataSet and load it with data from Menu.xml
Dim oDataSet As Data.DataSet = oIO.LoadXML("menu", "itemname", _
"itemdescription", "itemprice")
Return oDataSet
End Function
1. What is the proper way to reference the methods in Class "IO"? Using the syntax localhost.IO seems to work but I don't think this is what I want to do.
2. I want to keep everything in the IO Class abstract so it can be reused. When IO.LoadXML is called I want to be able to pass it 1 or 100 variables depending on the XML file. The implementation that I'm trying is erroring (see below). Any ideas? Thanx!
Compiler Error Message: BC30311: Value of type 'String' cannot be converted to '1-dimensional array of String'.
Source Error:
Line 18: Dim oIO As New localhost.IO()
Line 19: 'Create a DataSet and load it with data from Menu.xml
Line 20: Dim oDataSet As Data.DataSet = oIO.LoadXML("menu", "itemname", _
Line 21: "itemdescription", "itemprice")
Line 22: Return oDataSet