From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

DataSockets in Wondreware

Is there any experience out there with using the Datasocket control in
Wonderware Intouch.
Trying to use it to communicate back to a VB program. Get a Wonderware error
that that
object is read-only, when trying to write data to it, even though it is
configured for WriteAutoUpdate.
Other Componentworks objects communicate ok using the Bindings properties.

Thanks,
Bill Strenk
0 Kudos
Message 1 of 8
(4,650 Views)
Yes!

Wait, I mean no. I am having this very same problem, except in Visual J++
6.0.

com.ms.com.ComFailException: Property is read-only
at cwds/_DCWDataSocketDefault.setData (_DCWDataSocketDefault.java)
at cwds/CWDataSocket/CWDataSocket.setData (CWDataSocket.java:125)
at ....
at ...
etc .....

I tried creating the CWDataSocket object as an ActiveX component, and by
"Add COM Wrapper...". Same error both ways (not that I expected any
different, but hey, it was worth a shot).

Sorry I can't be of any help to you, Bill. I don't even know what Wonderware
is.

Did you ever figure it out? Does National Instruments monitor these
newsgroups?

- Matt Hanger


"MARY BETH STRENK" wrote in message
news:38c65617@newsgroups.ni.com...
> Is th
ere any experience out there with using the Datasocket control in
> Wonderware Intouch.
> Trying to use it to communicate back to a VB program. Get a Wonderware
error
> that that
> object is read-only, when trying to write data to it, even though it is
> configured for WriteAutoUpdate.
> Other Componentworks objects communicate ok using the Bindings properties.
>
> Thanks,
> Bill Strenk
>
>
0 Kudos
Message 2 of 8
(4,650 Views)
Hi,

Yes, we do try to check up on the newsgroups.

I don't have an immediate answer for this question, since I haven't gotten
this error message myself. The error message is somewhat helpful, but it
would be much more informative when paired with the code that produced the
error. If Matt or Bill could post some sample code, then I will take a look.


Regards,
Denise Riedlinger
CW Software Engineer

"Matt Hanger" wrote:
>Yes!>>Wait, I mean no. I am having this very same problem, except in Visual
J++>6.0.>>com.ms.com.ComFailException: Property is read-only> at cwds/_DCWDataSocketDefault.setData
(_DCWDataSocketDefault.java)> at cwds/CWDataSocket/CWDataSocket.setData (CWDataSocket.java:125)>
at ....> at ...> etc .....>>I tried crea
ting the CWDataSocket object as an
ActiveX component, and by>"Add COM Wrapper...". Same error both ways (not
that I expected any>different, but hey, it was worth a shot).>>Sorry I can't
be of any help to you, Bill. I don't even know what Wonderware>is.>>Did you
ever figure it out? Does National Instruments monitor these>newsgroups?>>-
Matt Hanger>>>"MARY BETH STRENK" wrote
in message>news:38c65617@newsgroups.ni.com...>> Is there any experience out
there with using the Datasocket control in>> Wonderware Intouch.>> Trying
to use it to communicate back to a VB program. Get a Wonderware>error>> that
that>> object is read-only, when trying to write data to it, even though
it is>> configured for WriteAutoUpdate.>> Other Componentworks objects communicate
ok using the Bindings properties.>>>> Thanks,>> Bill Strenk>>>>>>
0 Kudos
Message 3 of 8
(4,650 Views)
Sure... here it goes...

First, I create a new "Windows Application" project in Visual J++. Then, I
add a CWDataSocket control to the form. I set the URL and accessMode
properties in the properties window of the control. Then my code looks
something like this :

Variant v = new Variant();
cwds.CWData cwd = new cwds.CWData();

v.putString("Some String");
cwd.setValue(v);

CWDataSocket1.Connect();
CWDataSocket1.setData(cwd);

The connection to the DataSocket server is established.... then I get the
exception on the setData() call.

com.ms.com.ComFailException: Property is read-only
at cwds/_DCWDataSocketDefault.setData (_DCWDataSocketDefault.java)
at cwds/CWDataSocket/CWDataSocket.setData (CWDataSocket.java:125)

It should be noted that I can create
a Visual Basic application, add a
CWDataSocket control, and set the data property there without incident.
However, Visual Basic will not satisfy the requirements of my current
project.

Thanks,

- Matt Hanger



"denise" wrote in message
news:38e2abce@newsgroups.ni.com...
>
> Hi,
>
> Yes, we do try to check up on the newsgroups.
>
> I don't have an immediate answer for this question, since I haven't gotten
> this error message myself. The error message is somewhat helpful, but it
> would be much more informative when paired with the code that produced the
> error. If Matt or Bill could post some sample code, then I will take a
look.
>
>
> Regards,
> Denise Riedlinger
> CW Software Engineer
0 Kudos
Message 4 of 8
(4,650 Views)
I neglected to mention that I have the accessMode property set to
"cwdsWriteAutoUpdate", and I do have permission to create and write to
objects on the DataSocket server.

Thanks again for your help,

- Matt Hanger
- spambait@endian.cx
0 Kudos
Message 5 of 8
(4,650 Views)
HI Matt,

As the error message indicates, Data is a read only property. If you want
to assign a CWData object to the DataSocket.Data member, use the CopyFrom
method:
'vb sample
Dim cwd As New CWData
'fill in cwd
'copy cwd to the DataSocket control
CWDataSocket1.Data.CopyFrom cwd
'update server with new data
CWDataSocket1.Update

Note that the help for the CopyFrom function states that Update method will
get triggered automatically after CopyFrom. But I had to explicitly call
Update in order to send the data to the server.

Hope that helps,
Denise

"Matt Hanger" wrote:
>Sure... here it goes...>>First, I create a new "Windows Application" project
in Visual J++. Then, I>add a CWDataSocket control to the form. I set the
URL and accessMode>properties in the properties window of the control. Then
my code looks>something like this :>>Variant v = new Variant();>cwds.CWData
cwd = new cwds.CWData();>>v.putString("Some String");>cwd.setValue(v);>>CWDataSocket1.Connect();>CWDataSocket1.setData(cwd);>>The
connection to the DataSocket server is established.... then I get the>exception
on the setData() call.>>com.ms.com.ComFailException: Property is read-only>
at cwds/_DCWDataSocketDefault.setData (_DCWDataSocketDefault.java)> at cwds/CWDataSocket/CWDataSocket.setData
(CWDataSocket.java:125)>>It should be noted that I can create a Visual Basic
application, add a>CWDataSocket control, and set the data property there
without incident.>However, Visual Basic will not satisfy the requirements
of my current>project.>>Thanks,>>- Matt Hanger>>>>"denise"
wrote in message>news:38e2abce@newsgroups.ni.com...>>>> Hi,>>>> Yes, we do
try to check up on the newsgroups.>>>> I don't have an immediate answer for
this question, since I haven't gotten>> this error message myself. The error
message is somewhat helpful, but it>> would be much more informative when
paired with the code that produced the>> error. If Matt or Bill could post
some sample code, then I will take a>look.>>>>>> Regards,>> Denise Riedlinger>>
CW Software Engineer>>>
0 Kudos
Message 6 of 8
(4,650 Views)
Denise,

Thanks for your help, but I don't see how I can use the CopyFrom function in
J++. I know that the ComponentWorks ActiveX controls probably weren't
designed with J++ in mind, but I'm sure there's a way? If not, then maybe it
will give the ComponentWorks developers something to work on for a future
release 🙂 I can't possibly be the first person to use CWDataSocket with J++
can I?

Anyhow, I believe I'm beginning to understand DataSocket a bit more. In
Visual Basic, you don't need to use CopyFrom, you can just say :

'CWDataSocket1.Data.Value = some value

You can also just say :

'CWDataSocket1.Data = some value

It seems that 'Value' is implied in Visual Basic. So, the Data property is
read-only, but the value can be set by specifying Data.Value or
Data.CopyFrom, at least in Visual Basic. (Side question, shouldn't the
object browser specify if a property is read only?).

However, none of this will work in J++. Or, if it can, I'm not seeing it. In
J++, when you use an ActiveX control or plain-old COM object, it creates the
..java files for you automatically. So, the only way I can access the Data
property is via getData() or setData(), and that doesn't give me access to
the CopyFrom() method or the Value property.

Again, thanks for all your help so far. Hopefully we will be able to find a
solution soon.

- Matt Hanger


"denise" wrote in message
news:38e3eced@newsgroups.ni.com...
>
> HI Matt,
>
> As the error message indicates, Data is a read only property. If you want
> to assign a CWData object to the DataSocket.Data member, use the CopyFrom
> method:
> 'vb sample
> Dim cwd As New CWData
> 'fill in cwd
> 'copy cwd to the DataSocket control
> CWDataSocket1.Data.CopyFrom cwd
> 'update server with new data
> CWDataSocket1.Update
>
> Note that the help for the CopyFrom function states that Update method
will
> get triggered automatically after CopyFrom. But I had to explicitly call
> Update in order to send the data to the server.
>
> Hope that helps,
> Denise
0 Kudos
Message 7 of 8
(4,650 Views)
ComponentWorks was designed as ActiveX controls that could be used from any
ActiveX container. It is challenging for us to provide language specific
support for the numerous containers out there. So, I will tell you what
theoretically should work.
In VB, the gets and sets are not obvious, since you only use the property
name.
If you want to access an object, such as CWData, use getData. Then you can
modify it using setValue or CopyFrom on the CWData object returned from getData.
You may even be able to chain the calls together, as in CWDataSocket1.getData().setValue


denise

"Matt Hanger" wrote:
>Denise,>>Thanks for your help, but I don't see how I can use the CopyFrom
function in>J++. I know that the ComponentWorks ActiveX controls probably
weren't>designed with J++ in mind, but I'm sure there's a way? If not, then
maybe it>will give the ComponentWorks developers something to work on for
a future>release 🙂 I can't possibly be the first person to use CWDataSocket
with J++>can I?>>Anyhow, I believe I'm beginning to understand DataSocket
a bit more. In>Visual Basic, you don't need to use CopyFrom, you can just
say :>>'CWDataSocket1.Data.Value = some value>>You can also just say :>>'CWDataSocket1.Data
= some value>>It seems that 'Value' is implied in Visual Basic. So, the Data
property is>read-only, but the value can be set by specifying Data.Value
or>Data.CopyFrom, at least in Visual Basic. (Side question, shouldn't the>object
browser specify if a property is read only?).>>However, none of this will
work in J++. Or, if it can, I'm not seeing it. In>J++, when you use an ActiveX
control or plain-old COM object, it creates the>..java files for you automatically.
So, the only way I can access the Data>property is via getData() or setData(),
and that doesn't give me access to>the CopyFrom() method or the Value property.>>Again,
thanks for all your help so far. Hopefully we will be able to find a>solution
soon.>>- Matt Hanger>>>"denise" wrote in message>news:38e3eced@newsgroups.ni.com...>>>>
HI Matt,>>>> As the error message indicates, Data is a read only property.
If you want>> to assign a CWData object to the DataSocket.Data member, use
the CopyFrom>> method:>> 'vb sample>> Dim cwd As New CWData>> 'fill
in cwd>> 'copy cwd to the DataSocket control>> CWDataSocket1.Data.CopyFrom
cwd>> 'update server with new data>> CWDataSocket1.Update>>>> Note that
the help for the CopyFrom function states that Update method>will>> get triggered
automatically after CopyFrom. But I had to explicitly call>> Update in order
to send the data to the server.>>>> Hope that helps,>> Denise>>>
0 Kudos
Message 8 of 8
(4,650 Views)