[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] vb.net and activex dll



sorry, i had a typo in the email message.  I still get an the following errors.

"Specified cast is not valid" on line #4
and a 
"Invalid Cast Exception: Cast from type '_ComObject' to type 'String' is not valid. " Line #5


private sub xmlScriptAccess_update(byval msg as object) handles
xmlBlaster.XmlScriptAccessSource_Event_update
 
    dim qos as object 
    dim contentStr as string
    dim byteContents() as Byte = new Byte(1024) {}  ' byte array of
1 try
2   qos = msg.getQos()                 ' OK
3   len = msg.getContents().length     ' OK returns 344
4   byteContents= msg.getContent()     ' EXCEPTION
5   contentStr = msg.getContentStr()   ' EXCEPTION
6   xmlBlaster.setUpdateReturn("<qos><state> id='OK' /></qos>")
7catch e as SystemException
8   msgBox(e.toString())
9 end try
...


----- Original Message -----
From: Marcel Ruff <mr at marcelruff.info>
To: xmlblaster at server.xmlBlaster.org
Subject: Re: [xmlblaster] vb.net and activex dll
Date: Fri, 29 Oct 2004 11:40:37 +0200

> 
> Silver Blea wrote:
> > hello,
> > 
> > I am tyring to get the vb.net activex demo working. However, I am
> > having a
> > problem with the asynchronously subroutine XmlScriptAccess_update.  I
> > am
> > able to successfully connect to the server, howerver, a get invalid
> > cast
> > exceptions when I try to get the messge contents.
> > 
> > Environment: W2K, JDK1.5.0, VB.NET
> > (sending a text file of size = 344)
> > 
> > private sub xmlScriptAccess_update(byval msg as object) handles
> >    xmlBlaster.XmlScriptAccessSource_Event_update
> > 
> >    dim qos as object 
> >    dim contents, contentStr as string
> >    dim byteContents() as Byte = new Byte(1024) {}  ' byte array of
> > size 1K
> >    try
> >       qos = msg.getQos()                 ' no errors
> >       len = msg.getContents().length ' returns 344
> >       contents = msg.getContents()           ' ERROR
> >       contentStr = msg.getContentsStr()       ' ERROR ALSO
> > 
> >       xmlBlaster.setUpdateReturn("<qos><state>
> > id='OK' /></qos>")
> > catch e as SystemException
> >       msgBox(e.toString())
> > end try
> > 
> > end sub
> > 
> > whats the proper method to get the data out (string or byte array?). 
> 
> Hi Silviano,
> 
> please correct the method call from
> 
>    msg.getContentsStr()
> 
> to
> 
>    msg.getContentStr()
> 
> (Note there is no 's' after Content)
> 
> The 'msg' is of type
> 
>   http://www.xmlblaster.org/xmlBlaster/doc/client-api/org/xmlBlaster/client/activex/UpdateEvent.html
> 
> 
> The other setup is similar to mine, only i've used WinXP instead
> of W2K, but i think this shouldn't matter,
> 
> regards
> 
> Marcel
> 
> 
> > thanks
> > in advance.
> > 
> > Silviano Blea Jr.
> > sblea at cs.unm.edu
> > (505) 853-0462 (Office)
> > 
> 
> 
> -- 
> http://www.xmlBlaster.org
> 

-- 
_______________________________________________
Get your free Verizonmail at www.verizonmail.com