Solved

VB.NET XML Question

Posted on 2006-07-11
10
1,133 Views
Last Modified: 2012-06-27
I am using VB.NET to build a program for a Windows CE 5.0 Device.

Dim objXMLHTTP as New MSXML.XMLHTTPRequest()  produces the following error:

COMException was unhandled

COM object with CLSID '{ ................ }' cannot be created due to the following error: 0x80040154
Check the ErrorCode property of the exception to determine the HRESULT returned by the COM object.


Thanks in advance.
0
Comment
Question by:AndySulz
  • 5
  • 5
10 Comments
 
LVL 3

Expert Comment

by:Kudzullc
ID: 17082699
Have you tried to catch the error?  I have done some work with HTTPREQUEST successfully.

Try
        do.Events
Catch ex As Runtime.InteropServices.COMException
        MsgBox(ex.ToString)
End Try

this may help identify the error more explicitly.  swap Runtime.InteropServices.COMException with IOException and XMLException also for different types of exceptions.

gl,
Lucas
0
 
LVL 2

Author Comment

by:AndySulz
ID: 17082952
ex.ToString:

"System.Runtime.InteropServices.COMException (0x80040154): COM object with CLSID '{ED8C108E-4349-11D2-91A4-00C04F7969E8}' cannot be created due to the following error: 0x80040154."

I've done work before with VB6, eVB 3.0, .NET for windows but never for CE ... i'm kind of at a loss.

0
 
LVL 3

Expert Comment

by:Kudzullc
ID: 17083477
Can you add a breakpoint and check the url you are creating in an open browser to see if the information is correct?  right before you ask for the response, add a breakpoint and check the System.URL next to the + marker while hovering over the request, copy and paste it into a browser like IE, see what the browser response is.

Can you include the the try statement including events?

Lucas
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 2

Author Comment

by:AndySulz
ID: 17083926
The error comes on the Dim objXMLHTTP as New MSXML.XMLHTTPRequest() line ... i can't even get to the .open method.
0
 
LVL 3

Accepted Solution

by:
Kudzullc earned 125 total points
ID: 17084002
Can you provide your code...?  Here is an example of what I have done in the past.

                    Dim objRequest As HttpWebRequest = HttpWebRequest.Create("http://www.google.com")
                    Dim objResponse As HttpWebResponse = objRequest.GetResponse
                    Dim sourceCode As New System.IO.StreamReader(objResponse.GetResponseStream)
                    strHelp = sourceCode.ReadToEnd
                    MsgBox(strHelp.ToString)

If XML is returning in the strHelp variable, then you can parse and use accordingly.  This actually returns the source code of the web site.

Unfortunately I can not find any information on the XMLHTTPRequest object.

Also, big also here, make sure you have the proper namespaces above the class definition.  In the above code i used these namespaces...

Imports System.Xml
Imports System.Net
Imports System.Web
Imports System.IO

gl,
Lucas
0
 
LVL 2

Author Comment

by:AndySulz
ID: 17084050
Try
            Dim objXMLHTTP As MSXML.XMLHTTPRequest   <<Errors out here<<
            Dim objOutputXMLDoc As MSXML.DOMDocument

            objXMLHTTP = New MSXML.XMLHTTPRequest

            objXMLHTTP.open("POST", "http://10.10.10.11:8080/AppServer/se_appserver", False)
            objXMLHTTP.setRequestHeader("Content-Type", "text/xml")

            objXMLHTTP.send(XMLCommand)

            Dim myResponseSTR As String
            myResponseSTR = objXMLHTTP.responseText
            If Not objOutputXMLDoc.loadXML(myResponseSTR) Then MsgBox(objOutputXMLDoc.parseError.srcText)
            retval = objOutputXMLDoc.selectNodes("//AppServerResponse/retval")

        Catch ex As Runtime.InteropServices.COMException
            MsgBox(ex.ToString)
        End Try
0
 
LVL 2

Author Comment

by:AndySulz
ID: 17084125
Ok, your sample works but I need to post data ... could your code be modified in order to do that?
0
 
LVL 3

Expert Comment

by:Kudzullc
ID: 17084217
Are you trying to give a URL data and retrieve specific information from the request given?  This is a very simple way to upload a string.  aybe this can push you in the right direction...is the appserver using ASP or Coldfusion?

 Dim web As New System.Net.WebClient()
 web.Headers.Add("Content-Type", "text/xml")
 Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes("SEARCHSTRING=test")
 Dim res As Byte() = web.UploadData("http://somewhere.com/search.asp", "POST", d)
 MsgBox(System.Text.Encoding.ASCII.GetString(res))

gl,
Lucas
0
 
LVL 2

Author Comment

by:AndySulz
ID: 17084432
The appserver is a Servlet running in JBoss.  I used System.IO.StreamWriter with your code to send the post.  I really appreciate your help!
0
 
LVL 3

Expert Comment

by:Kudzullc
ID: 17084548
Great!  

gl,
Lucas
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 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