P. 1
How to create web service

How to create web service

|Views: 14|Likes:
Published by Gurudatt Kulkarni
web service,IDE
web service,IDE

More info:

Published by: Gurudatt Kulkarni on May 13, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

06/11/2014

pdf

text

original

Now we are going to create a Web Service and Access it without using .NET IDE. STEPS: 1. Create .

asmx file in NOTEPAD -> TEST IT USING BROWSER LIKE.... http://localhost/testweb.asmx 2. Create a proxy for you .asmx file using WSDL utility from .NET command prompt. Start-Programs-VS.NET 2003-VS.NET Tools-VS.NET Command prompt create a directory named bin , prompt> md bin (c://winnt//temp) prompt: >
wsdl /l:cs /n:wservice /out:bin/testweb.cs http://localhost/testweb.asmx?WSDL

/l: represents language to produce output, /n: means namespace, /out: to store output This will create, a sourcefile named testweb.cs with a namespace wservice for reference. 3. Create a dll file from the .cs to access at run time from your client. prompt > csc /t:library /out:bin\testweb.dll bin\testweb.cs csc -- csharp compiler /t -- target file is a library file means .dll /out -- to store output 4. Create your web service client inlcude the namespace and call the service.

testweb.asmx --> Web Service _____________
<%@ WebService Language="C#" Class="testweb" %> using System; using System.Data; using System.Data.OleDb; using System.Web.Services; public class testweb : WebService { [WebMethod] public DataSet show () { OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\winnt\\temp\\db1.mdb");

Fill(DS).Tables[0]. MyDataGrid. } } testwebclient. MyDataGrid.Data.Close(). con). return DS. DataSet DS = new DataSet().DataBind().DefaultView.Data" %> <%@ Import Namespace="System.OleDbDataAdapter da = new OleDbDataAdapter("select * from Table1". da. con.DataSource = MyData.aspx --> Web Service Client ___________________________________ <%@ Page Language="C#" Explicit="true" Strict="true" Buffer="true"%> <%@ Import Namespace="System.OleDb" %> <%@ Import Namespace="wservice" %> <html> <script language="C#" runat="server"> void Page_Load(Object sender.show(). EventArgs e) { testweb obj = new testweb(). DataSet MyData = obj. } </script> <form runat="server"> <ASP:DataGrid id="MyDataGrid" runat="server" /> </form> </body> </html> . con = null.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->