Hi, does anyone knows how to read wcf file using xdocument or xelement ? I would like to retrieve out the data from my database using web client instead service reference method. Does anyone have articles on that or the codings ?

Is there something wrong with using a service reference?
If you're using C#, it might be the best thing.

Otherwise, can you go directly to the database?

If the WCF exposes itself on HTTP, you can query it with a System.Xml.Linq.XDocument.
Since I don't have an online WCF page to use for testing, I have a WS demo that might use the same technique.
This example queries the page for all of the Zip Codes and Cities in the state of Tennessee.
I used the System.Xml.Linq.XDocument because it's easier to use.

using System;
using System.Xml.Linq;

namespace DW_394766
{
   class Program
   {
      static void Main(string[] args)
      {
         try
         {
            string strURI = "http://www.webservicex.net/uszip.asmx/GetInfoByState?USState=TN";
            XDocument xd = XDocument.Load(strURI);

            foreach (XElement xe in xd.Elements().Elements())//two levels down
            {
               Console.WriteLine("Zip={0}\tCITY={1}",
                  xe.Element("ZIP").Value,
                  xe.Element("CITY").Value);
            }
         }
         catch (Exception exc)
         {
            Console.WriteLine("Could not load page: " + exc.Message);
            return;
         }
      }
   }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.