05/30/2017
The OPC Foundation has created a simple website to demonstrate how to use JSON, JavaScript and REST like APIs to communicate with the .NETStandard ReferenceServer (see https://github.com/OPCFoundati…..emo/webapi).
The site can be found here: https://prototyping.opcfoundation.org
This documentation for the JSON encoding is here: https://reference.opcfoundatio…..Part6/#5.4
The documentation for the the HTTPS binding is here: https://reference.opcfoundatio…..Part6/#7.4
The documentation for the WebSockets binding is here: https://reference.opcfoundatio…..Part6/#7.5
The documentation for the Sessionless Service calls used to implement the WebAPI is here: https://reference.opcfoundatio…..Part4/#6.3
This thread is for questions and discussions.
If someone has done their own OPC UA JSON/JavaScript implementation and they want to tell people about them please leave a link in this thread.
07/29/2019
Hello
I just tried the demosite prototyping.opcfoundation.org, and when using the Subscribe demo, its unable to connect to the OPC-UA Server at address prototyping.opcfoundation.org:62542. I remember the trainer from the demo said he had to open the port temporarly.
So am I right with the assumption that this sample will not work anymore at all or is it just a network / server issue and the server should be reachable again?
I want to build my own node.js / React / Typescript sample here in my office and need a server to get the data from.
Greetings and thanks for the nice example.
Alex
05/30/2017
The server is still running, however, I cannot access from FireFox on some machines.
Edge seems to work.
You should also be able to use the .NET client to connect using websockets in:
https://github.com/OPCFoundati…../Reference
04/13/2020
Since the presentation the websocket example uses the non-reversible form (the example before used the reversible form).
Could you change it back to the reversible form?
NotificationData provides an array of ExtensionObjects and in the reversible form the type id of this ExtensionObject has to be present
This is not the case in the example:
{
"TypeId": {
"Id": 827
},
"Body": {
"ResponseHeader": {
"Timestamp": "2020-04-14T06:15:08.4207221Z",
"RequestHandle": 6,
"StringTable": []
},
"SubscriptionId": 15,
"AvailableSequenceNumbers": [
2
],
"MoreNotifications": false,
"NotificationMessage": {
"SequenceNumber": 2,
"PublishTime": "2020-04-14T06:15:08.4207221Z",
"NotificationData": [
{
"!!!!!!!!!!! TypeId IS MISSING !!!!!!!!!!!!!!!!!"
"Body": {
"MonitoredItems": [
{
"ClientHandle": 1,
"Value": {
"Value": {
"Type": 11,
"Body": 1.789481742797868e+35
},
"SourceTimestamp": "2020-04-14T06:15:07.5858651Z"
}
}
],
"DiagnosticInfos": []
}
}
]
},
"Results": [
0
],
"DiagnosticInfos": []
}
}
05/30/2017
The UA subscription model includes flow control so updates are only sent after the client indicates it is ready to receive them.
Clients ready to received will send multiple Publish requests that are held on the server until changes to the data are detected.
When using a full-duplex channel like websockets the client can send the publish requests and then use the same channel for other services.
IOW, it make look like polling in a simple application but architecturally it is not.
05/30/2017
In theory, the JavaScript communicates directly with the UA server.
In practice, cross-sight scripting rules (CORS) mean scripts can only communicate with the site that served the scripts.
CORS could be addressed in a number of ways:
- Have the UA server act as a HTTP server that provides the HTML/scripts
- Use HTTP rewrite rules on the server that redirect JSON requests to the UA server (AKA reverse proxy);
- Have a web method forward the JSON to the UA server;
The example uses 3), however, this is least elegant solution.
2) is probably the best for real solution.
07/03/2024
Hi. This seems to be a old post, but since it is a sticky I will try to post here instead of making a new post.
1) The server/example seems to be down? Is it running on another URL?
2) Is the source code for the example available somewhere?
We are building a automation system using PLCs (Siemens and/or Codesys) but for the HMI we need to use standard html/js/web browser functionality. We are a bit stuck on the best architecture on this system. The PLS and HMI are on the same physical network, so they should be able to communicate with each other without to many security restrictions. We would like to reduce the complexity and number of hardware/servers to facilitate communication between the PLS and HMI, and thus would like to use standard REST API or websockets to communicate “directly” with the PLS without needing a web server/proxy/etc in the middle. Is this possible?
Any one know if siemens and codesys supports JSON serialization and websocket communication?
What are our options? We have made a working prototype using a “OPC-UA client to websocket server” using node.js in the middle but as mentioned previously it adds (unnecessary?) overhead and complexity.
Anyone knows if there is any opc-ua clients that works in the browser?
05/30/2017
All the above is out of date.
As of 1.05.04, all JSON/WebSockets implementations are done with OpenAPI definitions.
Pure UA client written in TypeScript + React:
https://opcua-rest-dashboard.a…..sites.net/
Clicking ‘Connect’ will switch to WebSockets.
OpenAPI definition for API:
https://opcua-rest-dashboard.a…..et/swagger
Code is here (member only, preparing for public release):
https://github.com/OPCF-Member…..estGateway
Simple clients in Python and C#:
https://github.com/OPCF-Member…..RestClient
Code generated using OpenApi definitions.
Constants needs for a client will be normative files maintained by the OPC-F:
https://github.com/OPCF-Member…..st/OpenApi
1 Guest(s)