Creating an ASP.NET web services and consuming it with a Win Form  
<< Back Page 2

Two other properties worth mentioning are BufferResponse and CacheDuration.

BufferResponse controls if the entire message is to be buffered before it is returned (left blank or written as BufferResponse=true) or if it is chunked into 16KB responses. The size of our message is small enough that there is no benefit to chunking. Consider using this if you are returning large serialized files or data sets.

CacheDuration allows you to set the number of seconds that you want the system to cache the results of the method call. Since I am calling a method that returns the time I will omit it. Leaving it blanks means the service will use the default value of 0 seconds.

You can browse to it and, if it is local, you can invoke it in the services page.

Next we are going to create a Win Form to consume the service. Create a new Windows Application. You can call it whatever you like.

You have to add a web reference to the service so you can get access to the exposed methods. Just like adding an ASMX file to your ASP.NET project, you can add a web reference to this Win Form application by either selecting the Project menu item or by right clicking the solution name in the solution explorer.

This launches the Add Web Reference dialog box. You have the option of entering a URL to an ASMX or WSDL file of having the system browse DISCO or UDDI directories to find it. Since we know exactly what we are looking for enter in “http://www.sapago.com/Services.asmx?WSDL.” This creates a reference called com.sapago.www.

.NET Add Web Reference Dialog Box

 


Facebook •  Twitter •  LinkedIn •  Windows Live Space •  Plaxo •  MSN  •  Channel9 •  Spock  •  Google •  Programmer's Heaven  •   Variable Markup  •  San24  •  Yahoo Profile  •  Excite UK  •  Amazon  •  Google Search  •  TGZ  •  Google •  ExciteUK  •  Angelfire  •  Canadian Content  •  411 ASP  •   Interactiva