Hello,
I am trying to call a local web service. I followed the tutorial here
http://www.codeproject.com/soap/ConsumWebServicefromASP.asp
the MSXML method. Here is my rather simple code. But everytime I hit
the Server.CreateObject line, Visual Basic IDE complains about
"Runtime Error 424, Object Required".
In Project References I have a lot of MS XMLs listed (v2.0, 2.6, 3.0,
4.0, 5.0, 6.0). I have tried them all. I even used xmlinst.exe to
revert everything back to MSXML3. (Even though when I go to Add/Remove
Programs I see MS XML v4 SP2, and MS XML v6). I would have removed
MSXML6 and MSXML4 had I not feared that they might be needed by Visual
Studio 2005 which is also an environment I use.
I am basically trying to call a .net web service from a VB6 console
application. Here is my code:
Public Function CallWS()
Dim xmlhttp
Dim DataToSend
DataToSend = "iCompanyID=123"
Dim postUrl
postUrl = "http://localhost/1WayWebService/Service.asmx/
StartYearEnd"
Set xmlhttp = server.CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "POST", postUrl, False
xmlhttp.setRequestHeader "Content-Type", _
"application/x-www-form- urlencoded"
xmlhttp.send DataToSend
End Function
But the program craps out at
Set xmlhttp = server.CreateObject("MSXML2.XMLHTTP")
I have run out of ideas. Any input ?
Anthony Jones - 15 Oct 2007 12:46 GMT
> Hello,
>
[quoted text clipped - 36 lines]
>
> I have run out of ideas. Any input ?
The example you are looking at is for ASP and uses ASPs Server object.
Just use CreateObject instead of Server.CreateObject.
However to make the code more VB you should reference the MSXML3.dll and use
New MSXML2.XMLHTTP30. Use better types on the variables too.

Signature
Anthony Jones - MVP ASP/ASP.NET