Link to home
Start Free TrialLog in
Avatar of valon76
valon76

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of bugs021997
bugs021997
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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
Avatar of valon76
valon76

ASKER

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?
Avatar of valon76

ASKER

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.

@valon76

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