BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


WCF, WS, SOAP
Use XMLDOM and XMLHTTP Documents to Upload Small Files
Temperature Conversion XML WebService
SOAP Client Over HTTP Using Visual C++
SOAP Toolset for VB 6.0
Remote Database Administer via XMLHTTP
Binding XML Data Island to Web Forms
Security Model for Web Services
What is a XML Web Service?


 
 

<< UncategorizedXALAN >>


By Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First Posted 02/24/2002
Times viewed 254

Web Service and DHTML


This post contains attachments
v20020224171838.zip 

Summary This article explains how we access the Web Service through DHTML webservice behavior.

 Before this article, I discussed on how to create web service, how to create proxy client and how to consume web services in ASP.NET.

In this article, I’ll discuss how we can access web services through DHTML by using WebService behavior.

 In ASP.NET, if we want to update some part of the html page we are required to display new html page with updated information. Actually, we don’t wish to create a new html page, to update a part of the page for results. So one of the solutions is use WebService behavior from DHTML. What is Web Service behavior?

 WebService behavior is a reusable DHTML component that uses Web Services by communicating over HTTP using SOAP protocol. This WebService behavior enables client side script to invoke remote interfaces exposed by Web Services that support SOAP and WSDL 1.1. The WebService behavior is written as an HTML Component, which uses the emerging SOAP standard to communicate with Web Services on the server. It works with Internet Explorer 5.0 or later.

 In my earlier article titled Web Services and ASP.NET, I gave an example on how to invoke the Web Service methods through ASP.NET. Now I will use the same Web Service here and try to explain how we can use WebService behavior to access its methods Add, Subtract, Multiply and Divide.

 The first step in using the WebService behavior is to attach it to an element using the STYLE attribute of an element and set the ID attribute so that this element can be referenced easily in the script.

Here is code how to attach WebService behavior

             <div id=divService style=behavior:url(webservice.htc)></div>

The webservice.htc file can be placed in any folder but within the same domain.

 The second step is load the Web Service by specifying the path of Web Service.

The following is the code how to load the Web Service.

             divService.useService(SimpleCalculator.asmx?WSDL,myCalc);

 Here useService() method establishes connection for a Web Service. SimpleCalculator.asmx?WSDL is the Web Service Description Language of our Web Service and myCalc is the friendly name for the Web Service.

 The third step is communication with the Web Service.

The following is the piece of code, which does that communication in asynchronous way.

             nCallID = divService.myCalc.callService(MyResult,Add,inp1,inp2);

 Here the callService() method invokes the remote server interface Add() with arguments inp1 and inp2 for Add() method.

The response message or error message occurred during the communication with the Web Service is stored in an object called MyResult.

The value returned by Web Service method Add() can be obtained from MyResult.value.

If there is any error, we can check MyResult.errorDetail. The properties of errorDetail gives detailed information about the error.

In this way, we can update a part of the web page information without displaying new web page.

Additional information

Further additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< UncategorizedXALAN >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML