How to Build and Host Web Services on Windows
2003 Servers
.NET (pronounced "dot net") is a hot term today and everyone
from corporate programmers to casual
developers are attempting to use the service to its fullest.
.NET is the Microsoft platform for hosting XML Web services. XML
Web services
is a methodology which enables diverse applications to share data
and other communications across networks including WANs, VPNs and
the Internet.
It doesn't take a huge investment in technology to leverage .NET
and XML Web services. In fact, any Windows 2003 web hosting account,
even a cheap web hosting account like the ones provided by http://www.web-host-plus.com
, is capable of hosting .NET applications.
.NET Development Languages
While the data and communication layers that are handled by XML
Web Services are not language-specific, the actual web service projects
are usually developed in one of the .NET-compliant languages including
VB.Net, ASP.NET, C#, J#, and VC.NET, among others.
Creating a Simple .NET Web Service
For the purposes of this tutorial, let's say that we have just
created a web service called "HelloWorld" using Visual
Studio (VS) and C#.
When you first defined the project in VS, you defined a project
name and a location (fully qualified URL) where the web service
would run. Let's use "HelloWorldWebService" for the project
name and http://localhost for the location. Once you entered that,
VS created a virtual folder called "HelloWorldWebService"
under your IIS directory, created a new solution called "HelloWorldWebService",
and generated several required support files including a project
which is also called "HelloWorldWebService".
You then used the Integrated Development Environment (IDE) to edit
the generated file Service1.asmx and add the required code to return
the "Hello World" string.
Unlike HTML, ASP, PHP and other development platforms, simply uploading
your .NET project to your web server isn't all that's needed to
go live. Now it's time to build the service so you can get it hosted
on your cheap web server at http://www.web-host-plus.com.
Hosting Your Web Services Application
Once you have developed the service, choose "Build" from
the project menu. VS compiles and builds your web service and transfers
the required files to your server if you haven't made any programming
errors.
Once the process is completed, the .NET web service is ready to
be "consumed" by a client application using one of the
standard protocols like HTTP, SMTP, Form Posts or Gets, or SOAP.
There are two roles in the web services family. The "producer"
develops web services, and the "consumer" uses web services.
Depending upon how much access your web services application is
going to get, you can probably host it easily enough on any of the
cheap hosting sites like http://www.web-host-plus.com.
Because Web Services are not executed by browsers, they are consumed
by client applications, you can not test the web service simply
by calling it directly. Instead, you have to navigate to what is
known as a "service endpoint", which is a file that can
interact with a browser. This is automatically handled by .NET which
generates an HTML test page every time it receives a request for
any page ending in .asmx.
You can see this in operation by entering http://localhost/HelloWorldWebService/HelloWorldWebService.asmx,
or whatever the location was that you used for your project, into
your browser. Now .NET generates a page named "HelloWorldWebService.cs.asmx"
and displays it in the browser.
This test page displays the HelloWorldWebService name, along with
the HelloWorldWebService() method, and a link to what is called
the "service description". The service description is
an XML document conforming to the Web Service Description Language
(WSDL) specification. This document is what makes the web service
so "transportable" and able to be consumed by various
client applications.
Conclusion
Of course, you're not going to do anything earth shaking with HelloWorldWebServices,
but now you understand how easy it is to host web services on Windows
2000 servers like those that you can get at http://www.web-host-plus.com.
Back to the technical support section