calling a .net web service from classic ASP page

How can i can call a .net web service from an ASP page? are there any sites/sources that i can check this out on?

I need to see how this is done via ASP(preferably in vbscript), not ASP.net. I can only find samples on th einternet using ASP.net. I am much more familiar with using using web services in vb.net, but not aware of how to do this using classic ASP.

Any help appreciated thanks

mikeandbeeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1makCommented:
Here's an article that takes you through the process...

Basically, you open the webservice, passing your parameters as a querystring, and parse the resultant XML all using the Microsoft XMLHTTP class.
mikeandbeeAuthor Commented:
i think you forgot to paste the actual article in your comment, not? Could you please re-post.

thanks
mikeandbeeAuthor Commented:
i need to see that article, i presume it shows the code behind how to do this in vbscript?
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

1makCommented:
Really sorry mikeandbee, rookie mistake...

http://www.aspfree.com/articles/576,1/articles.aspx
SqueebeeCommented:
I don't use ASP, but PocketSOAP works extremely well for me in plain old VB-land.

http://www.pocketsoap.com/pocketsoap/
mikeandbeeAuthor Commented:
i really need an example where I can send an XML request to the web service. The example given just sends a request like so:
SoapRequest.Open "GET",SoapURL , False
SoapRequest.Send()
But I actually want to send an XML string inside this request. Can you show me an example fo this? And how would i handle the response?
thanks
rychsCommented:
Hello
  Here is an example using Google's beta search service. This code is for client-side but it could easily be switched to server-side using JScript.

<script language="JavaScript">
function searchFor(arg)
{      
      objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
      try
      {
            objHTTP.open("post", "http://api.google.com/search/beta2", false);
      }
      catch(error)
      {
            if(error.description == "Permission denied" || error.description == "Access is denied")
            {
                  var msg = "Your current security settings prevent access to this web service.<br>"
                  msg = msg + "To enable this service:<br>1. Go to the Tools menu and select Internet Options<br>"
                  msg = msg + "2. Click the security tab at the top of the page<br> 3. Click the Custom Level button<br>"
                  msg = msg + "3. Find the topic 'Access Data Sources Across Domains' and set it to prompt<br>"
                  msg = msg + "4. Click OK and then OK again and you will be able to access the web service<br><br>"
                  msg = msg + "OR <a style='cursor:hand;text-decoration:underline;' onclick='window.open(\"GoogleWebService.asp?arg=" + arg + "\", \"\", \"width=300,height=300,toolbar=no,scrollbars=yes\")'>"
                  msg = msg + "Click here</a> to view the results in a new window<br><br>"
                  msg = msg + "<a style='cursor:hand' onclick=google.style.display='none';return false;>Close Window</a>"
                  
                  google.innerHTML = msg;
                  google.style.top =  document.body.scrollTop + 10
                  google.style.display = "block";
                  
            }
            return false;
      }
      objHTTP.setRequestHeader("Content-Type", "text/xml");
      
      strEnvelope = "<?xml version='1.0' encoding='UTF-8'?>";
      strEnvelope = strEnvelope + "<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' ";
      strEnvelope = strEnvelope + "xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' ";
      strEnvelope = strEnvelope + "xmlns:xsd='http://www.w3.org/1999/XMLSchema'>";
      strEnvelope = strEnvelope + "<SOAP-ENV:Body>";
      strEnvelope = strEnvelope + "<ns1:doGoogleSearch xmlns:ns1='urn:GoogleSearch' ";
      strEnvelope = strEnvelope + "SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>";
      strEnvelope = strEnvelope + "<key xsi:type='xsd:string'></key>";
      strEnvelope = strEnvelope + "<q xsi:type='xsd:string'>" + arg + "</q>";
      strEnvelope = strEnvelope + "<start xsi:type='xsd:int'>0</start>";
      strEnvelope = strEnvelope + "<maxResults xsi:type='xsd:int'>10</maxResults>";
      strEnvelope = strEnvelope + "<filter xsi:type='xsd:boolean'>true</filter>";
      strEnvelope = strEnvelope + "<restrict xsi:type='xsd:string'></restrict>";
      strEnvelope = strEnvelope + "<safeSearch xsi:type='xsd:boolean'>false</safeSearch>";
      strEnvelope = strEnvelope + "<lr xsi:type='xsd:string'></lr>";
      strEnvelope = strEnvelope + "<ie xsi:type='xsd:string'>latin1</ie>";
      strEnvelope = strEnvelope + "<oe xsi:type='xsd:string'>latin1</oe>";
      strEnvelope = strEnvelope + "</ns1:doGoogleSearch>";
      strEnvelope = strEnvelope + "</SOAP-ENV:Body>";
      strEnvelope = strEnvelope + "</SOAP-ENV:Envelope>";
      
      //********** Google **********************
      objHTTP.send(strEnvelope);
      xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
      var temp = unescape(objHTTP.responseText)
      xmlDoc.loadXML(temp);
      titleNodes = xmlDoc.getElementsByTagName("title");
      urlNodes = xmlDoc.getElementsByTagName("URL");

      var holder = "<span style='cursor:hand;position:absolute;left:100;' onClick=google.style.display='none';>Close Window</span><br>"
      for(i=0;i < urlNodes.length;i++)
      {
            holder = holder + (i + 1) + ".<a href='" + urlNodes.item(i).text + "' target='_blank'>&nbsp;"
            holder = holder + titleNodes.item(i).text + "</a><br>"
      }
      google.innerHTML = holder;
      google.style.top =  document.body.scrollTop + 10
      google.style.display = "block";
}
</script>

It won't work because I removed the key value that google gave me. If you want to test it, request a key from google's site.

Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stephenmmitchellCommented:
Below is a link to a text file called SoapTools.asp.

You can include that script into your asp file and use the example code at the bottom to send an XML request and how to pull the information coming back.

The Example Code is the big commented section at the bottom of the SoapTools.asp.

You can ignore all the code above that, it will not need to change only included in your asp file.

http://www.vermeeralabama.com/SoapTools.asp

I hope this helps.
stephenmmitchellCommented:
Sorry about that link, it was incorrect.  Try this one

http://www.vermeeralabama.com/SoapTools.txt

-Stephen
pinaldaveCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

"Accept rychs  comment as answer."

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Pinal Dave
EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.