?
Solved

How to return an ArrayList from a web service

Posted on 2003-03-03
9
Medium Priority
?
293 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:tyknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 20

Expert Comment

by:Silvers5
ID: 8055908
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
 

Author Comment

by:tyknight
ID: 8056045

 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
 

Author Comment

by:tyknight
ID: 8056175

 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
Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

 
LVL 7

Expert Comment

by:Joe_Griffith
ID: 8057296
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
 

Author Comment

by:tyknight
ID: 8057760
The line "Return list" is in the web service method already.
0
 

Author Comment

by:tyknight
ID: 8061585
The line "Return list" is in the web service method already.
0
 

Accepted Solution

by:
tyknight earned 0 total points
ID: 8062682
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9650651
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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question