locked
REST Webservice requirements RRS feed

  • Question

  • User1180806401 posted

    Hi Guys,

    I'm a newbie in Webservices and don't have a problem with SOAP WebServs where all I need is a url to the WSDL file to use in order to consume it.

    BUT I don't quite have a the same grasp with REST WebSevs, and my first question is Do I MUST use API of WCF to create them?

    I'm using VS 2010 and have created a simple empty Web project then add to it WebService to it (intending to be a REST WS)  and it this WebService.cs class I have a query that return some data:

    [WebService(Namespace = "http://tempuri.org/")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    public class WebService : System.Web.Services.WebService

    {

           public WebService()    {   }

        [WebMethod]

        public DataTable GetEmployees()

        {

         CacheConnection cnCache1 = cvCacheConnection.OpenCvCacheConnection();

         string SQLText = " Select top 10 EmployeeNumber, GivenNames from cvEmployee.Employee  ";

         CacheCommand command = new CacheCommand(SQLText, cnCache1);

         CacheDataReader reader = command.ExecuteReader();

         DataTable dt = new DataTable();

         dt.Load(reader);

         command.Dispose();

         reader.Close();

         reader.Dispose(true);

              return dt;

        }

    So now I can run this webservice and see the GetEmployees method and invoke it which returns some data in an XML format. (http://localhost:57088/cvDesktop/WebService.asmx?op=GetEmployees)

    Now that part that I'm confused about is, what makes this webservice a REST not a SOAP one because because I still canb use WSDL file with this one, or does it depends on the URL used (eg. http://localhost:57088/cvDesktop/WebService.asmx?op=GetEmployees) for REST or (http://localhost:57088/cvDesktop/WebService.asmx?WSLD) for SOAP?

    Thanks Guys

    Monday, November 27, 2017 5:03 AM

All replies