Using Web Service (.NET) in Classic ASP via SOAP

Web services are a great tool to share data across many data sources within a single organization, even if the owners of the different sources don’t want to give others direct access to the data.
here I am showing how you can call web service in classic asp.
To start, create a Web Service in Visual Studio.NET or use existing web service.
here is my web service login.asmx coding file (login.cs),

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
/// Summary description for Login
/// <code>
[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
public class Login : System.Web.Services.WebService {
public int LoginValidate(string email, string PW)
bool OK = false; 

// validate email or pW
if(email =="[email protected]" && PW=="ashish")
OK = true;
return OK;

To fatch data or access Web Service via SOAP, you need to download SOAP 3.0 in your sever or local computer where you host asp page.
Here is classic asp coding (Default.asp)


<%  Option Explicit %>


Public Function IsValidUser(Email, Pass)

Dim objSoapClient

SET objSoapClient = Server.CreateObject("MSSOAP.SoapClient30")

objSoapClient.ClientProperty("ServerHTTPRequest") = True

' needs to be updated with the url of your Web Service WSDL and is

' followed by the Web Service name

Call objSoapClient.mssoapinit("http://ashishblog/login.asmx?WSDL", "Login")

' use the SOAP object to call the Web Method Required

IsValidUser = objSoapClient.LoginValidate(Email, Pass)

End Function



Dim submitted, password, email

submitted = request.form("submitted")

if submitted <> "" then

submitted = true

email = request.form("email")

password = request.form("password")

Dim valid

valid = IsValidUser(email,password)

Response.Write valid

End If


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">

<head runat="server">


<style type="text/css">


{width: 96px;}




<form action="Default.asp?a=1"  method="post" name="memberLogin" AUTOCOMPLETE="off">

<%If request.queryString("a") <> 1 then%>

<table width="300" border="0" cellpadding="3" cellspacing="0">


<table cellspacing="1" cellpadding="3">

<tr><td class="r3">Email Address: </td>

<td class="r2"><input name="email" type="text" size="50" maxlength="128" style="width: 246px" /></td>


<td class="r3">Password:</td>

<td class="r2"><input name="password" type="password" size="50" maxlength="15" style="width: 246px" /></td>


<td colspan="2" class="r2" align="right"><input type="hidden" name="submitted" value="true" />

<input name="submit" type="submit" id="submit2" alt="Login" align="bottom" />




<%End If %>


Here is design mode of Default.asp page


One response to “Using Web Service (.NET) in Classic ASP via SOAP”

  1. how to pass xml as argument
    i need some help….
    my project is like that…
    UI is generate file.xml its pass as a parameter to .dll file (ui n .dll on same machine)..
    now this .dll retun a xml file which is pass as a parameter to ws…
    my problem is-> how to pass xml as a parameter to ws???

Leave a Reply to abhi