Solved

Consuming web service in classic ASP

Posted on 2009-04-15
2
331 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Leverage browser caching 2 55
Replacing smart quotes from word 7 67
JQuery Date Time picker not showing 29 114
JSON error 4 54
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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

Need Help in Real-Time?

Connect with top rated Experts

29 Experts available now in Live!

Get 1:1 Help Now