Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.NET XML Question

Posted on 2006-07-11
10
Medium Priority
?
1,147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 500 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

609 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