Web Service Example

In this example we will create a simple Calculator web service that exposes one function GetRandomNumber(). Web services require that ASP.NET and IIS are installed on the host machine. Both of these products should be installed automatically by the .NET Framework setup. The first step is to create a directory on your machine that will house your web service (call it C MyWebService). The IIS Configuration tool is then used to turn this directory into a virtual directory, which makes files stored...

Core Concepts

Producing .NET applications and components requires a compiler that translates source code into IL code. VS.NET, Microsoft's new version of Visual Studio, contains three such compilers VB.NET, C , and managed C . While a full examination of these languages is beyond the scope of a CodeNote, each language is briefly discussed below. Code examples throughout this book will demonstrate some of the nuances of each language and the syntactical differences between them. In addition to the IDE, VS.NET...

Custom Attributes

In the previous example, the metadata in WatSoft.DLL allowed us to dynamically call the Add method using reflection. This metadata was of the standard variety it was produced by the C compiler to describe all the types contained within the assembly. Attributes also produce metadata that we can exploit through reflection. Up to this point, we have differentiated between predefined attributes, which already exist, and custom attributes, which you write yourself. The reality is that all attributes...

Http Post Example

Vb6 Http Post

When communicating with a web service via HTTP POST, data is embedded as name-value pairs in the HTTP request's message body. Unlike HTTP GET, the name-value pairs do not appear as part of the URI. In this example we call the Calculator component that we developed in the Web Service Example section of this chapter. Unlike in the Web Service Example, however, we will not use the web browser to communicate via HTTP GET. Instead, we will use a properly formatted HTTP POST request to access the...