Click here to Skip to main content
15,891,723 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I am trying to call the webservice,it is saying like the above error, I want to save the return result odf webservice as xml in local system. My codes are -

My webservice calling code is:
C#
DataSet ds = new DataSet();
       private void Window_Loaded(object sender, RoutedEventArgs e)
       {
           WpfApplication4.ServiceReference1.Service1SoapClient   proxy = new WpfApplication4.ServiceReference1.Service1SoapClient ();
           proxy.getfeeds=ds;

           ds.WriteXml(@"D:\satish\sab.xml", XmlWriteMode.WriteSchema);

My webservice code is:
XML
[WebMethod]
       public List<feeds> getfeeds()
       {
           List<feeds> feed = new List<feeds>();
           DataSet ds = new DataSet();
           ds.ReadXml(@"D:\satish1\na.xml");
           var query= from  item in ds.Tables[2].AsEnumerable()
                      select new feeds
                      {
                          titl=item.Field<string>("title"),
                          des=item.Field<string>("description")
                      };
           foreach (var s in query)
           {
               feed.Add(s);
           }
           return feed;
       }


   }
       public class feeds
       {
          public string titl { get; set; }
           public string des { get; set; }
       }

       }
Posted
Updated 8-Jan-12 22:41pm
v2

1 solution

The error message is quite specific - you are trying to assign a value to a method name (The "method group" bit is because all methods with the same name are a group to allow for overloading)
When you write
C#
proxy.getfeeds=ds;
It is the equivalent of writing
C#
Console.WriteLine = "hello";
 
Share this answer
 
Comments
satishmachineni 9-Jan-12 5:48am    
can u tell me how to write and store ir in local system, even i checked my code using binding to gridview its working
OriginalGriff 9-Jan-12 5:58am    
Without knowing your code (and I can't see more than you give us, remember) I would guess that you want to reverse the assignment:
proxy.getfeeds=ds;
becomes
ds = proxy.getfeeds();
satishmachineni 9-Jan-12 6:03am    
my entire code is posted above,i want to save the results of webservice as xml in local system, i tried u r guess , one error,
cant implicitly convert wpfapplication.servicerefernce.arrayoffeeds to system.data.datset;
OriginalGriff 9-Jan-12 6:57am    
That is because your getfeeds method returns a List, which you can't assign directly to a DataSet.
There is a Tip here: http://www.codeproject.com/Tips/226720/Converting-a-List-to-a-DataTable
Which will convert a list to a DataTable - you would then just have to add it to your DataSet with
ds.Tables.Add(myDataTable);
satishmachineni 9-Jan-12 6:54am    
thanks solved it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900