Monday, 3 December 2012

Steps for creating ASP.NET WebService


Procedure:[Web service]

Server:

File->New->Web Site->(Visual C#) ASP.Net Web Service

Press F5 and Run the application and Copy the URL

Client:

File->New->Project->(Visual C#) Console Application

Go to Solution Explorer-> Right Click on Reference->Choose Add Service Reference
               Paste the URL in Address Bar & Click Go Button
                                               
                                               
Sample code:[Server]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]

public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components
        //InitializeComponent();
    }

    [WebMethod]
    public string HelloWorld()
    {
        return "Everybody listen....";
    }
   
}

[Client]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace trial
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceReference.ServiceSoapClient gs = new ServiceReference.ServiceSoapClient();
            System.Console.WriteLine("Response message:"+gs.HelloWorld());
            System.Console.ReadLine();
        }
    }
}
                                                

DBT - Models

Models are where your developers spend most of their time within a dbt environment. Models are primarily written as a select statement and ...