ASMX not showing webmethod that should return a dataset

G

Guest

Hi all...

I'm fairly new to buildling web services in .NET 2.0. Using VB.NET (2005),
I'm doing something like this in a webmethod:

- instantiating a 3rd party business object (QuickBooks customers actually)
- iterating through the collection and adding rows to a DataTable in a DataSet
- Returning the DataSet ("Return dsCustomers")

I've got other webmethods that return strings working just fine. I know the
code in this method works, because I've tested it inside an ASP.NET page.

My questions are:

1) if it compiles, why wouldn't the method show up in the service's ASMX page?
2) what's the best way to debug a web service like this?

Thanks,
Michael
 
W

W.G. Ryan [MVP]

Do you have it marked with the WebMethod attribute? That's the usual
culprit. You can use the debugger like you normally would but I'd recommend
logging once it's past development.
 
G

Guest

Yes... I'm using it exactly as I am for methods that ARE working...

Any thoughts?

Michael
 
G

Guest

Here's my code:

<WebMethod()> _
Private Function LoadCustomers() As System.Data.DataSet

Dim dsClients As System.Data.DataSet
Dim tblClients As System.Data.DataTable
Dim drClient As System.Data.DataRow
Dim dcClientName As System.Data.DataColumn
dsClients = New System.Data.DataSet
tblClients = New System.Data.DataTable("Clients")
dcClientName = New System.Data.DataColumn("ClientName",
Type.GetType("System.String"))
tblClients.Columns.Add(dcClientName)
dsClients.Tables.Add(tblClients)

qbCustomer.Reset()
qbCustomer.QBXMLVersion = "CA3.0"
qbCustomer.QBConnectionMode =
nsoftware.IBizQB.VendorQBConnectionModes.cmDontCare
qbCustomer.QBConnectionString =
ConfigurationManager.AppSettings("IbizQB")
qbCustomer.OpenQBConnection()

Objsearch.Reset()
Objsearch.QBXMLVersion = "CA3.0"
Objsearch.QBConnectionMode =
nsoftware.IBizQB.ObjsearchQBConnectionModes.cmDontCare
Objsearch.QBConnectionString =
ConfigurationManager.AppSettings("IbizQB")
Objsearch.OpenQBConnection()

Objsearch.QueryType =
nsoftware.IBizQB.ObjsearchQueryTypes.qtCustomerSearch
Objsearch.ActiveStatus =
nsoftware.IBizQB.ObjsearchActiveStatus.asActiveOnly
Objsearch.Search()
Dim i As Integer

For i = 0 To Objsearch.ResultCount - 1
qbCustomer.QBResponseAggregate = Objsearch.ResultAggregate(i)

If qbCustomer.ParentId = "" Then

drClient = dsClients.Tables("Clients").NewRow
drClient.Item("ClientName") = qbCustomer.CustomerName
dsClients.Tables("Clients").Rows.Add(drClient)
drClient = Nothing

End If
Next i

If qbCustomer.QBOpenCompanyFile.ToString <> "" Then
qbCustomer.CloseQBConnection()
End If
If Objsearch.QBOpenCompanyFile.ToString <> "" Then
Objsearch.CloseQBConnection()
End If
qbCustomer = Nothing
Objsearch = Nothing

Return dsClients
End Function
 
J

Jeff Dillon

Shouldn't it be Public and not Private?

Michael Reinhart said:
Here's my code:

<WebMethod()> _
Private Function LoadCustomers() As System.Data.DataSet

Dim dsClients As System.Data.DataSet
Dim tblClients As System.Data.DataTable
Dim drClient As System.Data.DataRow
Dim dcClientName As System.Data.DataColumn
dsClients = New System.Data.DataSet
tblClients = New System.Data.DataTable("Clients")
dcClientName = New System.Data.DataColumn("ClientName",
Type.GetType("System.String"))
tblClients.Columns.Add(dcClientName)
dsClients.Tables.Add(tblClients)

qbCustomer.Reset()
qbCustomer.QBXMLVersion = "CA3.0"
qbCustomer.QBConnectionMode =
nsoftware.IBizQB.VendorQBConnectionModes.cmDontCare
qbCustomer.QBConnectionString =
ConfigurationManager.AppSettings("IbizQB")
qbCustomer.OpenQBConnection()

Objsearch.Reset()
Objsearch.QBXMLVersion = "CA3.0"
Objsearch.QBConnectionMode =
nsoftware.IBizQB.ObjsearchQBConnectionModes.cmDontCare
Objsearch.QBConnectionString =
ConfigurationManager.AppSettings("IbizQB")
Objsearch.OpenQBConnection()

Objsearch.QueryType =
nsoftware.IBizQB.ObjsearchQueryTypes.qtCustomerSearch
Objsearch.ActiveStatus =
nsoftware.IBizQB.ObjsearchActiveStatus.asActiveOnly
Objsearch.Search()
Dim i As Integer

For i = 0 To Objsearch.ResultCount - 1
qbCustomer.QBResponseAggregate = Objsearch.ResultAggregate(i)

If qbCustomer.ParentId = "" Then

drClient = dsClients.Tables("Clients").NewRow
drClient.Item("ClientName") = qbCustomer.CustomerName
dsClients.Tables("Clients").Rows.Add(drClient)
drClient = Nothing

End If
Next i

If qbCustomer.QBOpenCompanyFile.ToString <> "" Then
qbCustomer.CloseQBConnection()
End If
If Objsearch.QBOpenCompanyFile.ToString <> "" Then
Objsearch.CloseQBConnection()
End If
qbCustomer = Nothing
Objsearch = Nothing

Return dsClients
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top