Hi again,
i have checked it now myself and you are right, byte[] is not properly transferred.
I've have found an ActiveX bridge bug at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4887461
The ActiveX bridge has problems to convert Java byte[] as described in bug_id=4887461.
I have now added a workaround for the ActiveX bridge bug so that we can transfer binary data. We offer now in the callback a method msg.getContentBase64() if you need to transfer binary data. If your content contains only strings (for example a xml string) you can use the convenience method msg.getContentStr().
Here is an example for the callback method update(), 'str' and 'decoded' contain the same result:
Private Sub XmlScriptAccess_update(ByVal msg As Object) _
Handles xmlBlaster.XmlScriptAccessSource_Event_update
Try
Dim str As String
Dim len As Int32
Dim encoded As String
Dim decoded As Byte() str = msg.getContentStr()
len = msg.getContentLength()
encoded = msg.getContentBase64()
decoded = Convert.FromBase64String(encoded)...
This is tested on WinXP.
Please get the newest code from subversion.
regards
Marcel
Silver Blea wrote:
Strange that this has worked: getContents() is not existing (note the 's')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 <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] 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. [EMAIL PROTECTED] (505) 853-0462 (Office)
-- http://www.xmlBlaster.org
-- http://www.xmlBlaster.org
