Solved

VB.NET XML Question

Posted on 2006-07-11
10
1,135 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

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