If you have a web service and a proxy class you need to develop a web-page client. Note: You can find more details about web services and proxy class by searching form them in the site.
If you are using Visual Studio as a basic environment you should:
1. To create a new web project.
2. Add a web reference to the web service.
If you are using another environment you should:
1. To compile a proxy class by using wsdl.exe.
2. Place it the new web application Bin directory.
The next example uses a simple web page with a button and a GridView control. When the user clicks the button, the web page posts back, creates the proxy class, retrieves the DataSet of books from the web service, and then displays the result by binding it to the grid.
You need to import the proxy class namespace, and then you can add the code that uses the proxy class to retrieve the data:
private void cmdGetData_Click(object sender, System.EventArgs e)
// Create the proxy.
BooksService proxy = new BooksService();
// Call the web service and get the results.
DataSet ds = proxy.GetBooks();
// Bind the results.
GridView1.DataSource = ds.Tables;
You can use the Object-DataSource to bind directly to the corresponding proxy class.
<asp:ObjectDataSource ID=”ObjectDataSource1″ runat=”server” SelectMethod=”GetBooks” TypeName=”localhost.BooksService” />
<asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”True”
From the point of view of your web-page code, there’s no difference between calling a web service and using an ordinary stateless class. You need to reduce the number of times you call the web service and be to handle exceptions resulting from network problems and connectivity errors. The basic reason for that is the fact that the web service that actually implements the business logic could be on a web server on the other side of the world.