How to return an ArrayList from a web service

I created a class employee and a web service method

Puclic Class Employee
Private _EmpID as String
Private _Name as String
   :
End Class

<WebMethod()> Function GetEmpList() As ArrayList
Dim list as New ArrayList
list.add(new Employee("Alice", "123456"))
   :
End Function

But it seems that no employee data return from the method.
How can i get a list of employees from web services?

Can anyone post some sample code or tell me where i can find solutions.
tyknightAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel SakrCommented:
hmm
Can you post how you are calling it from the client?
also try this proxy trace tool to debug your calls
http://www.pocketsoap.com/tcptrace/pt.asp

0
tyknightAuthor Commented:

 Dim kbs As New KBSEmp.Agent()
 Dim list As New ArrayList()
 list = kbs.GetEmpList()

SOAP response:

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetEmpListResponse xmlns="http://kbs.localhost.org/">
<GetEmpListResult>
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
</GetEmpListResult>
</GetEmpListResponse>
</soap:Body>
</soap:Envelope>
0
tyknightAuthor Commented:

 Dim kbs As New KBSEmp.Agent()
 Dim list As New ArrayList()
 list = kbs.GetEmpList()

SOAP response:

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetEmpListResponse xmlns="http://kbs.localhost.org/">
<GetEmpListResult>
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
<anyType xsi:type="Employee" />
</GetEmpListResult>
</GetEmpListResponse>
</soap:Body>
</soap:Envelope>
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Joe_GriffithCommented:
I think you need to tell the function what to return:

<WebMethod()> Function GetEmpList() As ArrayList
Dim list as New ArrayList
  list.add(new Employee("Alice", "123456"))
  :
  Return list   ' <--<<<
End Function
0
tyknightAuthor Commented:
The line "Return list" is in the web service method already.
0
tyknightAuthor Commented:
The line "Return list" is in the web service method already.
0
tyknightAuthor Commented:
I have fixed the problem. I use public instead of private

Puclic Class Employee
Public _EmpID as String  <-- use Public
Public _Name as String   <-- use Public
  :
End Class
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.