[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Classic ASP (VBScript)  Get Method Not working in web service

Posted on 2007-08-02
6
Medium Priority
?
874 Views
Last Modified: 2012-05-05
Hi,

I am trying to consume a .NET web service in classic asp using the GET method.  Here is the web service details:
http://ethor-com.sitepreview.ca/theGeoService.asmx

You can test the return values by:
http://ethor-com.sitepreview.ca/theGeoService.asmx/GetGeoCode?postalCode=92683&key=4f5328db-51e5-408e-ace6-3480f6b64a18


Here is the Classic ASP code that I am using that I have modified from a web snippet:

<%@ Language=VBScript %>
<% Option Explicit
Dim objRequest, objXMLDoc, objXmlNode
Dim strZip, strKey

strZip = "92683"
strKey = "4f5328db-51e5-408e-ace6-3480f6b64a18"

Set objRequest = Server.createobject("MSXML2.XMLHTTP")
objRequest.open "GET", "http://ethor-com.sitepreview.ca/theGeoService.asmx/GetGeoCode?postalCode=" & strZip & "&key=" & strKey, False
objRequest.setRequestHeader "Content-Type", "text/xml"
objRequest.send

Set objXMLDoc = Server.createobject("MSXML2.DOMDocument")
objXmlDoc.async = false
'Response.Write(objRequest.ResponseXml)

Set objXmlNode = objXmlDoc.SelectSingleNode("string")
Response.Write( objXmlNode )
%>

I am getting the following error:
--------------------------------
Error Type:
Response object, ASP 0185 (0x80020003)
A default property was not found for the object.
/consumeWS2/test.asp
--------------------------------

Can anyone provide any assistance with this?

Thanks,

Mike
0
Comment
Question by:valon76
  • 4
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
bugs021997 earned 500 total points
ID: 19618947
I will try and check your code but till then try this


Response.Write consumeWebService()

Function consumeWebService()
    Dim soapClient
    Set soapClient = Server.CreateObject("MSSOAP.SoapClient")
    soapClient.ClientProperty("ServerHTTPRequest") = True
    soapClient.mssoapinit "http://test.com/eLearningService.asmx?wsdl"
    consumeWebService = soapClient.GetSize("BUGS")
End Function



Web method in C#:

[WebMethod]
public string GetSize(string name)
{
    return "Hello " + name;
}




Check this out, its an accepted solution there

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_22664132.html
0
 
LVL 14

Expert Comment

by:bugs021997
ID: 19618977
This can happen when you try to response write an object, e.g. as what your doing in your code...

Change the below line from your code
Set objXmlNode = objXmlDoc.SelectSingleNode("string")
To
objXmlNode = objXmlDoc.SelectSingleNode("string")

and then goahead with response.write

Trying to response.write an object will throw an error.
0
 
LVL 14

Expert Comment

by:bugs021997
ID: 19618985
I have revamped your code, use this and tell me if this helps

<%@ Language=VBScript %>
<% Option Explicit
Dim objRequest, objXMLDoc, objXmlNode
Dim strZip, strKey

strZip = "92683"
strKey = "4f5328db-51e5-408e-ace6-3480f6b64a18"

Set objRequest = Server.createobject("MSXML2.XMLHTTP")
objRequest.open "GET", "http://ethor-com.sitepreview.ca/theGeoService.asmx/GetGeoCode?postalCode=" & strZip & "&key=" & strKey, False
objRequest.setRequestHeader "Content-Type", "text/xml"
objRequest.send

Set objXMLDoc = Server.createobject("MSXML2.DOMDocument")
objXmlDoc.async = false
'Response.Write(objRequest.ResponseXml)

objXmlNode = objXmlDoc.SelectSingleNode("string")
Response.Write( objXmlNode )
%>




Cheers
^_^
BUGS
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:valon76
ID: 19619180
Hi Bugs,

Thanks for your quick responses.

The revamped code that you posted gives the same error.

The consumeWebService() function works on my machine, but on my production server it doesnt ( there seems to be some issue with the MSSOAP.SoapClient  and they havent been able to sort it out& it is giving the following error: WSDLReader:Analyzing the WSDL file failed HRESULT=0x80070057 - WSDLReader:No service entry found HRESULT=0x80070057 )  this is why I am trying to do it using the GET method.

Any other ideas?
0
 

Author Comment

by:valon76
ID: 19621881
I was able to get it to work using the following:
Function consumeWebService()
    Dim soapClient
    Set soapClient = Server.CreateObject("MSSOAP.SoapClient30")
    soapClient.ClientProperty("ServerHTTPRequest") = True
    soapClient.mssoapinit "http://test.com/eLearningService.asmx?wsdl"
    consumeWebService = soapClient.GetSize("BUGS")
End Function

I was referencing the wrong version.

0
 
LVL 14

Expert Comment

by:bugs021997
ID: 19622627
@valon76

Sorry was away for a while so couldn't reply back to you. Did it solve or still facing issues...
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

830 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