WebProWorld IT Forum |
Using Fdisk command I need some assistant I'm new using the fdisk command. I would like to reformat my whole hard drive, start clean...so I can install my o/s from scratch...What steps should I follow.
Internet 2 (Internet II) 100 times faster Internet Two the second version for the Internet. Internet 2 will be at 100 times the speed of the current Internet. Internet development. Internet the future. Internet Progress.
|
|
|
12.15.04
HTML Client For Web Services Using DHTML Behavior
By Dipal Choksi
In this example we will access a Web Service created in C# from an HTML client. The client does not use .Net Framework directly and instead accesses the Web Service functionality using the DHTML behavior.
Definitions:
Web Services are defined as programmable application logic that is accessible using standard Internet protocols.
DHTML behaviors are components that encapsulate functionality on a page. DHTML behaviors are available in IE5.5 and above. To be able to use the behavior in a Web Page in IE5.5, you will need to download the WebService.htc behavior file and save it in the same folder as your html page. The file can be downloaded from the following location: http://msdn.microsoft.com/downloads/samples/internet
/behaviors/library/webservice/webservice.htc
Program Details
Let's delve into the details of our program.
Step 1: Create the Web Service
Create the file that exposes our Web Service function using your favorite text editor or Visual Studio.Net. Shown below is the code for the Web Service.
<%@ WebService Language="C#" class="TestWS" %>
using System;
using System.Web.Services;
using System.Web.Mail;
[WebService] public class TestWS : System.Web.Services.WebService
{
[WebMethod] public int Add(int num1, int num2)
{
return num1 + num2;
}
}
Code Listing: Save as TestWS.asmx
The web service "TestWS" is very simple - it exposes only one function "Add" which accepts 2 integers as input and returns their sum as the output.
Step2 : Create the HTML Client
First we specify the web service behavior in the html file as follows
<div id="service" style="behavior:url(webservice.htc)" onresult="onWSresult()">
</div>
The id specified for this element to reference the element in script.
Next we map the web service URL to a user-friendly name ("Calculator" in this case).
We add this code in the OnLoad handler for the page to ensure that the web service is mapped before any methods are invoked on the web service.
service.useService ('http://localhost/site/ code/testws.asmx?WSDL','Calculator');
Now that the webservice is setup for access, we invoke the web service methods asynchronously in two steps. The advantage of asynchronous invocation is that the web page does not have to keep waiting for the web service to return. In the first step, the web method is invoked. A call back function is specified and when the web service completes execution, the callback function gets executed. As a second step, the call back function (or an "onresult" event, if no callback function is specified) gets fired when the web service returns after execution or a timeout error occurs.
The code to actually invoke the Web Service's web method is shown below. The web method is invoked when the "Add Numbers" button is clicked.
The input parameters to the callService method are "methodname" and the input parameters expected by the web service.
Read the Rest of the Article.
About the Author: Dipal Choksi is a Bachelor of Engineering (Computer Science). She has industry experience in team-effort projects and also as an individual contributor. She has worked on Visual Basic, Visual C++, Java, Directory Services, ASP projects |