Invoke VB.NET Web Service via Client-Side Script

Category:
C#, VB.NET, ASP.NET
Type:
Applications
Difficulty:
Intermediate
Author:
m.posseth@work

Version Compatibility: Visual Basic.NET, Visual Basic Script

More information:
This code wil show you how to call a webservice through script from the client side. I personally use this to submit and retrieve values on our company`s helpdesk website (all clients have IE 5.5 or higher)

you need the Microsoft webservice.htc file (included in the download and it must be in the same path as the html page)

The body of the page must contain ID="webServiceCallerBody" (you may also place this in a DIV tag instead of the body tag)

Two considerations to keep in mind :

1. I haven`t tested this on other browsers as IE 5.5 or higher and I doubt if it wil work

2. You can call webservices outside the domain the page is comming from however this wil result in a nasty warning screen from IE that the current page is retrieving information it has no control off. I did not notice this behavior on standalone local html files.

My test html page included in the download requests a webservice on my webserver. Please note that i can`t guarantee that it wil be functioning for years after this posting 11/13/2003.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download scriptwebservice.zip