TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Lasantha PW
NA
213
214.6k
Pass list object to a web service
Jun 3 2011 6:25 AM
Hi
check below code
In web service module
public class CommonDataAccess
{
DataManagerDataContext manager = new DataManagerDataContext();
public List<ConsolidatedList> retrieveCustomers()
{
List<ConsolidatedList> consolidatedList = (from customer in manager.ConsolidatedLists
select customer).ToList<ConsolidatedList>();
return consolidatedList;
}
public List<Customer> scan(List<ConsolidatedList> consolidatedList, List<Customer> customerList)
{
return (from a in customerList from b in consolidatedList where a.FirstName == b.Name1 select a).ToList();
}
}
public class SanctionScreening : System.Web.Services.WebService
{
CommonDataAccess commonDAL = new CommonDataAccess();
[WebMethod]
public List<Customer> getConsolidatedList(List<Customer> custlist)
{
return commonDAL.scan(commonDAL.retrieveCustomers(), custlist);
}
}
Web service test Application
private localhost.SanctionScreening proxy = new TestAMLBridge.localhost.SanctionScreening();
DataManagerDataContext manager = new DataManagerDataContext();
protected void Page_Load(object sender, EventArgs e)
{
proxy.getConsolidatedList(customers());
//proxy.getConsolidatedList(customers());
//List<Customer> cust = proxy.getConsolidatedList(customers());
}
private List<Customer> customers()
{
return (from cus in manager.Customers select cus).ToList();
}
Error Messages
Error 1 The best overloaded method match for 'TestAMLBridge.localhost.SanctionScreening.getConsolidatedList(TestAMLBridge.localhost.Customer[])' has some invalid arguments C:\Users\Lasantha\Documents\Visual Studio 2008\Projects\HelloWorld\TestAMLBridge\TestAMLBridge\Default.aspx.cs 21 13 TestAMLBridge
Error 2 Argument '1': cannot convert from 'System.Collections.Generic.List<TestAMLBridge.DAL.Customer>' to 'TestAMLBridge.localhost.Customer[]' C:\Users\Lasantha\Documents\Visual Studio 2008\Projects\HelloWorld\TestAMLBridge\TestAMLBridge\Default.aspx.cs 21 39 TestAMLBridge
Here i'm going to pass customerlist to webservice from my test application. Please guide me solve this problem
thanks
Reply
Answers (
3
)
Auto Log Off using window C#.net application
Textbox sum