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

Re: [xmlblaster] vb.net and activex dll



Dupuy, Robert wrote:
I don't program in vb.net normally, but I had similar experiences with
the activex bridge
As the original poster in this thread.

As a reminder, the original poster said:

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.getContent().length ' OK returns 344 4 byteContents= msg.getContent() ' EXCEPTION
5 contentStr = msg.getContentStr() ' EXCEPTION
6 xmlBlaster.setUpdateReturn("<qos><state> id='OK' /></qos>")


First msg.getContent() is returning Sbyte(), so that is one issue you
are having.
As for why msg.getContentStr() doesn't work, I also have a situation
where strings just won't be returnd by msg.getContentStr(),
msg.getContentBase64(),
msg.getQos().getClientProperty("myAge").getStringValue(), all of these
things are being typed as _ComObject, not as strings.

But I can get an Sbyte() via msg.getContent() and convert it manually
back to string data.  I cannot say this is the best way, but it works
anyway, so I can use xmlBlaster to do a proof of concept now.  If anyone
knows how to get Strings to return...that would be great.  I use Windows
XP and .NET framework 1.0.3705

Here is what I did:

            Dim str As String
            Dim contentSBytes As SByte()

            contentSBytes = msg.getContent()
            Dim contentBytes As Byte() = New Byte(contentSBytes.Length)
{}

            Buffer.BlockCopy(contentSBytes, 0, contentBytes, 0,
contentSBytes.Length)
            str = System.Text.Encoding.ASCII.GetString(contentBytes)

MsgBox(str)

Hi Robert,

your binary access was the missing gap in our VB.net demo, thanks!

Passing strings works fine here (and on other WinXP i know of) so it
must be some special settings (Unicode/UTF-8/versions?) you have.
JDK 1.5 with a current Win XP should work fine.

Marcel


-- http://www.xmlBlaster.org