Solved

Consuming web service in classic ASP

Posted on 2009-04-15
2
335 Views
Last Modified: 2012-05-06
Hello,
I am new to classic ASP. What is wrong in bellow code.
The code prints "Document not Loaded"
<html>
<head>
<title></title>
</head>
<body>
 
<%  
 
    Dim webServiceUrl, httpReq, node, myXmlDoc
    webServiceUrl = "http://cpp.cisco.com/cpp/CPPLDAP/CPPLDAP.asmx/AuthenticateCiscoUser?db=1&_username=myUserName&_password=myPassword!"
    'webServiceUrl = "http://teachatechie.com/GJTTWebServices/ZipCode.asmx/GetLocation?ZipCode=32218"
    
    Set httpReq = Server.CreateObject("MSXML2.ServerXMLHTTP") 
    
    httpReq.Open "GET", webServiceUrl, False 
    httpReq.Send 
    
    Set myXmlDoc =Server.CreateObject("MSXML.DOMDocument")	
 
    if myXmlDoc.load(httpReq.responseBody) Then
       Response.write("document loaded")
 
    else
       Response.write("document not loaded")
    end If
    
    Set httpReq = Nothing 
    'title = myXmlDoc.documentElement.ChildNodes(1).text
    'Response.write(title)
    
    'Set node = myXmlDoc.documentElement.selectSingleNode("//CITYSTNAME") 
    
    'If Not node Is Nothing Then 
        'consumeWebService = "<b>That zipcode is within this city:</b><font color = blue>" & node.text & "</font>" 
 
    'Else 
        'consumeWebService = "<b>There is no location associated with that zipcode.</b>" 
 
    'End If    
'Response.Write(consumeWebService)
         
%>
 
</body>
</html>

Open in new window

0
Comment
Question by:pankajgharge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
JoachimMartinsen earned 20 total points
ID: 24153335
The .responseBody returns text. And the myXmlDoc.load requires a file to be loaded, not plain text.

If the webServiceUrl url is directing to an xml file, try loading this directly into myXmlDoc.load without using MSXML2.ServerXMLHTTP. Like this:

myXmlDoc.load(webServiceUrl)

Another way is to save the text into an temporary xml file and then to load it to the myXmlDoc.load.

Hope this makes sense.
0
 
LVL 1

Author Comment

by:pankajgharge
ID: 24154615
Thanks, JoachimMartinsen
The document is loaded no issues.
But how can I catch a response of webservice. Its a authentication webservice and I need true or false in response.
I am very very new to asp page.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question