Hello all,
I think this should be a simple issue but I am having nothing but trouble. My code currently passes a system.object containing an array of paramaters to a web service. The WS then takes thes parameters and calls a stored procedure and returns a dataset to the calling web form. I have converted a former class into a web service with no luck. If I put the .vb file in the app_code folder it works fine, if I add it as a web reference from another location I get an error stating that there was an error creating the XML file.
Here is the calling code:
Dim clsGN as new Service
Dim ds as new DataSet
Dim arParams(0) as object
ds = clsGN.GetData("spName", arParms)
WS Code:
<WebMethod(MessageName:="GetData", Description:="gets dataset with parameters")> _
Public Function GetData(ByVal SPName As String, ByVal SPVals As Object) As DataSet
Dim oDS As New DataSet
Dim oDSVals As New DataSet
Dim adapter As SqlDataAdapter
Dim conn As SqlConnection
Dim comm As SqlCommand
'Get the paramater value types from the stored procedure
oDSVals = GetSPValueTypes(SPName)
'Initialize connection
conn = New SqlConnection(connectionString)
'Create Command
comm = New SqlCommand(SPName, conn)
comm.CommandType = CommandType.StoredProcedure
Dim x As Integer = 0
For x = 0 To SPVals.GetUpperBound(0)
Dim sType As New SqlDbType
Dim sParamName As String = String.Empty
'Get the SQL parameter data type from oDSVals to attach to the command parameters
sType = AssignSQLParameterType(oDSVals.Tables(0).Rows(x).Item("data_type"))
sParamName = oDSVals.Tables(0).Rows(x).Item("parameter_name")
comm.Parameters.Add(sParamName, sType)
comm.Parameters(sParamName).Value = SPVals(x)
Next
'Create adapter
adapter = New SqlDataAdapter(comm)
'Fill the dataset
adapter.Fill(oDS)
'Close the connection
conn.Close()
conn.Dispose()
comm.Dispose()
oDSVals.Dispose()
Return oDS
End Function
Thanks for your help.