Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / October 2007



Tip: Looking for answers? Try searching our database.

MSXML2.XMLHTTP - Object Required 424 Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
asadikhan@gmail.com - 12 Oct 2007 20:41 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.