.. _discovery_process:
Discovery Process
==================
This tutorial describes how you can make your OPC UA application visible for OPC
UA clients on the network with ASNeG OPC UA Stack.
Overview
---------
In order to allow OPC UA clients to find OPC UA servers in the network OPC UA
protocol specifies some special :term:`Discovery` mechanisms. The stack
supports two of them:
1. Simple Discovery with :term:`DiscoveryUrl`
2. Local Discovery Server
Below we'll explain how both mechanisms work and how you can use them by using
the stack.
Simple Discovery
----------------
The simple discovery is only possible when the client knows :term:`DiscoveryUrl`
of the server. In this case the client requests the :term:`Endpoint`\ s of the
server directly by calling *GetEndpoints* :term:`Service`. The server returns
its available :term:`Endpoint`\ s and the client can start communicating through
one of them:
::
Client Server
======== ================
| | |
| GetEndpoints() | |
I-------------------------->I |
I I |
I EndPointsDescriptions() I |
I<--------------------------I |
| | |
| | |
I CreateSecurityChannel() | |
I------------------------------------->I
I | I
| | |
Discovery Session
Endpoint Endpoint
As a developer you needn't to code this behavior. The stack do all automatically.
That you need, it is only to describe the :term:`Endpoint`\ s of your application
in configuration file **OpcUaServer.xml**:
.. code-block:: xml
opc.tcp://0.0.0.0:8888
urn:0.0.0.0:ASNeG:helloworld
urn:ASNeG:helloworld
helloworld
opc.tcp://0.0.0.0:8888
http://opcfoundation.org/UA/SecurityPolicy#None
None
http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15
SignAndEncrypt
OpcUaStack1
Anonymous
http://opcfoundation.org/UA/SecurityPolicy#None
OpcUaStack2
Username
http://opcfoundation.org/UA/SecurityPolicy#Basic256
OpcUaStack3
IssuedToken
http://opcfoundation.org/UA/SecurityPolicy#Basic256
OpcUaStack3
Certificate
http://opcfoundation.org/UA/SecurityPolicy#Basic256
http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary
0
As you can see the :term:`Endpoint` provides the client information about
application identification, communication and security policy so that the client
can connect to the application via TCP\\IP and open a :term:`Secure Channel`\ .
You can learn more about OPC UA security in section :ref:`Security`.
Local Discovery Server
----------------------
The local discovery server provides the list of the registered servers to the client.
If an OPC UA Server needs to be discovered by the clients, it should register itself
on the discovery server by using RegiserServer() or RegisterServer2() :term:`Service`\ s
In order to connect to the registered server, the client calls *FindRegister*
:term:`Service` on the discovery server to get the list of the servers. So that
the client needn't to know any :term:`DiscoveryUrl`\ s of servers excepting the
discovery server.
::
Client Discover Server Server
======== ================= ================
| | | |
| | RegisterServer() | |
| I<---------------------I |
| | | |
| FindServers() | | |
I-------------------------->I | |
I I | |
I ApplicationDescription[] I | |
I<--------------------------I | |
| | | |
| | |
| | |
| | |
| GetEndpoints() | |
I------------------------------------------------->I |
I I |
I EndPointsDescriptions() I |
I<-------------------------------------------------I |
| | |
| | |
I CreateSecureChannel() | |
I------------------------------------------------------------>I
I | I
| | |
Discovery Session
Endpoint Endpoint
If you use ASNeG OPC UA Stack you don't need to code the behavior described above.
You should configure the local discovery server in configuration file **OpcUaServer.xml**:
.. code-block:: xml
opc.tcp://localhost:4840
40000
References
--------------------
* :ref:`Security section `
* `ASNeG OPC UA Discovery Server `_
OPC UA Specification
--------------------
* Part 4 Services, 5.4 Discovery Service Set.
* Part 12 Discovery, 4 The Discovery Process.