Solved

Consuming web service in classic ASP

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Title # Comments Views Activity
Why Bundles is not working on certain files - ASP MVC 3 60
Help with query 3 31
Query still returning duplicates 5 41
edit .asp files 5 32
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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