?
Solved

Consuming web service in classic ASP

Posted on 2009-04-15
2
Medium Priority
?
338 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 60 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

765 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