Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1163
  • Last Modified:

VB.NET XML Question

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
AndySulz
Asked:
AndySulz
  • 5
  • 5
1 Solution
 
KudzullcCommented:
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
 
AndySulzAuthor Commented:
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
 
KudzullcCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
AndySulzAuthor Commented:
The error comes on the Dim objXMLHTTP as New MSXML.XMLHTTPRequest() line ... i can't even get to the .open method.
0
 
KudzullcCommented:
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
 
AndySulzAuthor Commented:
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
 
AndySulzAuthor Commented:
Ok, your sample works but I need to post data ... could your code be modified in order to do that?
0
 
KudzullcCommented:
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
 
AndySulzAuthor Commented:
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
 
KudzullcCommented:
Great!  

gl,
Lucas
0

Featured Post

Technology Partners: 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!

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now