Solved

VB.NET XML Question

Posted on 2006-07-11
10
1,126 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now