IoT Hub OPC UA Gateway Services
Users connecting their OPC UA Servers to ThingWorx want the ability to set up their incoming data from a single point. To enable them to use ThingWorx for that, a set of services for browsing OPC UA endpoints is provided on the AzureIotTemplate Thing Template. This set of services maps to the existing Industrial Gateway contract in ThingWorx. Data points selected are directly bound to Remote Things for reads and writes.
The OPC Twin Module is compatible with OPC UA servers such as ThingWorx Kepware Server (TKS).
The following public services are available through the Services page of the Thing that represents your Azure IoT Hub in ThingWorx Composer. They are not available on the Industrial Gateway Things.
Services on the Azure IoT Hub Thing for OPC UA
ThingWorx Service
Description
Returns
FetchUAEndpoints
Triggers the IoT Hub Connector to query Azure for a list of available OPC UA endpoints and then creates an Industrial Gateway Thing in ThingWorx Platform for each discovered OPC UA endpoint and binds each endpoint to the Thing. Note that these Things are ephemeral when created. It is up to you to persist them.
List of OPC UA endpoints.
AddUAApplication
Adds an OPC UA application, using the discovery URL for the application.
Success or failure. Returns the status code, STATUS_BAD_REQUEST if the request contains invalid parameters.
RemoveUAApplication
Deletes an OPC UA application, using the discovery URL for the application.
Success or failure. Returns the status code, STATUS_BAD_REQUEST if the request contains an invalid application ID..
GetUAApplications
Using an infotable of application information, queries the OPC UA server for a collection of UA applications.
Returns a collection of applications, with information items for each application, including the application IDs, the types of applications, the name and URI for an application, a product URI, a site ID, and a discoverer ID.
Returns the status code, STATUS_INTERNAL_ERROR if the REST call encounters errors..
ActivateUAEndpoint
Queries for the specified endpoint and, if found, activates it.
If the specified endpoint is found, activation is attempted and, if successful, the message, Endpoint activated: <endpoint name> is displayed.
If the specified endpoint is not found, it is not activated. The error message displayed is Endpoint not activated. Please ensure the endpoint is correct: <endpoint name>.
If the endpoint is null or empty, the service returns, Endpoint is null or empty.
DeactivateUAEndpoint
Queries for the specified endpoint and, if found, deactivates it.
If the endpoint is neither null nor empty, the service attempts deactivation. If an error occurs, it returns STATUS_INTERNAL_ERROR.
If the specified endpoint is found, deactivation is attempted and, if successful, the message, Endpoint deactivated: <endpoint Name> is displayed.
If the specified endpoint is not found, it is not deactivated. The error message displayed is Endpoint not deactivated. Please ensure the endpoint is correct: <endpoint name>.
If the endpoint has no associated information, the service returns, Endpoint is null or empty
GetUAPublishedNodes
Browses the OPC UA endpoint for published nodes.
If the endpoint is neither null nor empty, The service creates the Data Shape for the published nodes. It iterates over the nodes to retrieve the display name, node Id, publishing internal, and sampling interval. It stores the information in a JSON object and returns the status code, STATUS_SUCCESS.
If the endpoint is neither null nor empty, retrieves the published nodes for the endpoint. If an error occurs, returns the status code, STATUS_INTERNAL_ERROR.
If the endpoint is null or empty, returns the status code, STATUS_BAD_REQUEST and the message, Endpoint is null or empty.
If the endpoint has no data, , the services attempts too get the Data Shape with the result information and creates a value collection. It creates the string nullResult and stores it in the value collection.
If the data is not null but is empty, the service returns the message, No nodes currently published for endpoing: <endpoint name>.
AddIndustrialThing
Checks if a thingName exists and if not, adds an Industrial Gateway Thing using the RemoteThing Thing Template and binds the OPC UA node to that new Thing.
To avoid a potential race condition, the IndustrailThing must be enabled after a restart, which can happen if this service is invoked via a Save action. The service invokes a service that checks property subscriptions and if an error is not null, returns the status code, STATUS_INTERNAL_ERROR. Otherwise, it adds or updates properties in the map. If a JSON exception occurs, the message, Error when getting information from property: <property_name> is returned.
RemoveIndustrialThing
Unbinds and deletes the specified Thing from the database. It removes the associated property map entries.
Success or failure.
BrowseGroups
Browses groups on the root node. and returns a list.
If the call fails, it returns the message, browseGroups call returned a bad status (code: <code>).
If the call succeeds, the service returns a list of nodes. It builds a path for the groups that are nested inside another group. The following information is returned for each node:
A unique identifier for the node (ID)
A unique name for the node (NAME)
Whether the node is a system group (IS_SYSTEM_GROUP)
Whether the node has nested groups (HAS_ANY_SUB_GROUPS)
Whether the node has any non-system nested groups (HAS_NON_SYSTEM_SUB_GROUPS).
BrowseItems
Browses for items under the node and returns them in a list. If the node is the root node, returns the immediate children of the node. If the node is at a specified location (a "path" was provided), it returns the nodes under that path.
If there are no items, the service returns the message, browseItems returned null.
When there are items, it retrieves them and collects the following information for each item:
* 
For v.4.1.0 of the Azure IoT Hub Extension, the service, SetEndpointsCredentials, has been removed from the AzureIotHubTemplate Thing Template. The service is now available on the ConnectionServicesHub Thing provided in the Connection Services Extension (CSE). For the information about the service, refer to the topic, ConnectionServicesHub Thing, in this help center.