Call WebServices from ASP using Classes
Calling Web Service from ASP.NET is quite easy. To call Web Services from ASP, we sued to use SOAP SDK. But that is not necessary.
Actually, we can develop a class called, say, WebService, in a ASP page, and use that class to call Web Services. Inside this class, we use:
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
to communicate between the Web Service and the ASP,a nd then use
Set mCol = CreateObject("Scripting.Dictionary")
to manage the web service parameters in a form.
Once we have the class ready, the caller code is as simple as below (assuming you have already included the webservice class in your page:
dim ws
set ws = new webservice
ws.url = "http://localhost/yourwebservice.asmx"
ws.method = "MethodName"
ws.parameters.Add "ParamName1",1
ws.parameters.Add "ParamName2",300
ws.parameters.Add "ParamNameN",500
ws.execute
response.Write ws.response
set ws = nothing
For details, you can go to: http://www.codeproject.com/asp/aspcallwebservice.asp
The source code of the WebService Page can be downloaded here:
http://www.codeproject.com/asp/aspcallwebservice/aspcallwebservice_src.zip

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home