|
-
Jun 18th, 2003, 03:00 PM
#1
Thread Starter
Lively Member
WebService and returning service data or array
I am trying to setup a web service that is called from a .NET compact framework application and returns all the services on a particular machine. I can get this to work by filling an ArrayList with the service name, then returning it to the client. However, there are multiple properties that I need to return such as status, etc. I guess my question boils down to how can I return an array from a web service.
Here is some of my code(webservice):
Begin Class
<WebMethod()> _
Public Function GetServices(ByVal inServer As String) As ArrayList
Dim services() As ServiceController
Dim srvlist As ServiceController
Dim RetArray As New ArrayList
Dim item As String
services = ServiceController.GetServices(inServer)
For Each srvlist In services
Dim ItemName As New SvcDataObj
ItemName.DispName = srvlist.DisplayName
ItemName.DispSrvName = srvlist.ServiceName
ItemName.DispState = srvlist.Status
Dim myTest As String = ItemName.ToString
RetArray.Add(ItemName)
Next
Return services
End Function
Public Structure SvcDataObj
Public DispName As String
Public DispSrvName As String
Public DispState As ServiceProcess.ServiceControllerStatus
End Structure
End Class
Client code:
Dim WiSESvc As New servername.Service1
WiSESvc.GetServices("server")
I should be able to set the WiSESvc.GetServices("server") to an object, then iterate through all the services but this does not work. Any help would be GREATLY appreciated!
-
Jun 19th, 2003, 09:06 AM
#2
I wonder how many charact
Web services are a pain in the neck aren't they?
I can get some running on my home machine, but can't figure out to enable security access at my work machine (and I administer the damn network!) to allow my webservices to run there.
Anyway, my problem is totally opposite of yours... I keep getting Arrays returned and I want collections instead... WSDL always compiles using arrays and I can't figure out how to change that... so its a pain for debugging and development... I have to manually insert the proxy class into my project, change the arrays back to collections on each re-compile...
I feel like there is someone with a gun to my head saying , "you feel lucky punk? Go ahead... compile...", knowing full well if I introduced a bug, I'm going to have to go back and undo all the default array parameters WSDL used... just to test it out again...
Anyway good luck with that...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|