Let's start with a project for creating XML Web services using .NET
Framework 3.0.
Launch Microsoft Visual Studio 2008 shortcut, then press Ctrl-Shift-N,
then Visual C#, then Web (project type), then
ASP.NET Web Service
Application (templates), then WebService1 (project name and solution
name), and then OK (to create a new project).
On the left, you will see Service1.asmx.cs, the source code written
C#. On the right, there are files under WebService1 (project name),
namely:-
[x] Properties
-- AssemblyInfo.cs
[x] References
-- System
-- System.Configuration
-- System.Data
-- System.Drawing
-- System.EnterpriseServices
-- System.Web
-- System.Web.Mobile
-- System.Web.Services
-- System.Xml
[x] App_Data
[x] Service1.asmx
-- Service1.asmx.cs
[x] Web.config
Press Ctrl-F5 to trigger Microsoft Internet Explorer 7 to show a
directory listing with its own
ASP.NET Development Server, an icon
appeared in the system tray.
Now, click Service1.asmx from the Directory Listing column. You should
see a hyperlink HelloWorld on the web page, and a description of XML
Web service below it. Your web browser will identify the web page as
http://localhost:1033/Service1.asmx in its Address bar.
Move your mouse pointer to HelloWorld, and click once. You web browser
will show ?op=HelloWorld after
http://localhost:1033/Service1.asmx in
its Address bar.
Click Invoke, and the web browser opens another tab for the result
'Hello World' as shown in its Address bar,
http://localhost:1033/Service1.asmx/HelloWorld.
Press Alt-F4 to close the Web Browser. You may want to add some text
within the following paragraph:-
[WebMethod]
public string HelloWorld()
{
return "Hello World\n This is exciting!";
}
Press Ctrl-S to save the changes. Try to run the
ASP.NET Web service.
The \n in Web service doesn't recognise as a new line. Close the IDE
and its
ASP.NET Development server altogether.
THE END