Skip to main content
Version: 2.6

XML File to OPC-UA Bridge

This tutorial uses an XML Source as virtual device. Further an OPC-UA server is used to access the device information.

Preconditions

  1. HumanOS IoT Designer installed on development client (Check Installation Manual)

  2. OPC-UA Client installed on development client

RECOMMENDATION

Examples work with UAExpert from Unified Automation. Download UAExpert here

Step 1: Create an XML Source

First, an XML source file must be created.

File: C:\Temp\TestFile.xml

<?xml version="1.0" encoding="utf-8"?>
<Data>
<Value1>88</Value1>
</Data>

Step 2: Create an IoT Project

  1. Open the HumanOS IoT Designer v2 from Windows Start Menu.

  2. Create a new project and preselect "OPC UA Bridge"

    Create Project Step1

  3. Choose Product License Trial License and select the latest trial runtime installed on your development client

    Create Project Step2

  4. Click on "Device Templates" and add a new content.

  5. Select the device template XML and JSON File Connector and set name to XMLSource.

    Add Template

  6. Open the XMLSource document and select the first node XMLSource on the document page.

  7. Add a new Device Node (Right click or [+] button in the document page)

    Add DataNode

  8. Select Blank DataNode and set name to DataValue1.

  9. Select the added node and set the Address on property list (right side) to /Data/Value1

    Set Address

NOTE

Now your device template is ready. This template can be used multiple times to connect to different XML sources with the same structure.

Step 3: Connect the Device

Now we create a connection to the XML file from Step 1.

  1. Select the "Devices"-node below the "default"-target and add a new device.

    Add Device Step1

NOTE

If you have more than one device template, you can select now the template for your device.

  1. Specify the device. Set the "Address" to C:\Temp\TestFile.xml

    Add Device Step2

NOTE

Now your IoT project is now read for a first test run.

Step 4: Test your IoT Project

  1. Click on "Build and Run" to build and deploy the "default"-target.

    Deploy

  2. The HumanOS IoT Gateway is started in console mode

    Deploy

  3. Start "UAExpert" from Windows Start Menu

  4. Add a new connection. Use the connection address opc.tcp://localhost:4840.

    Deploy

  5. Connect to the HumanOS IoT Gateway. Because the server uses a self signed certificate, confirm that it is trustworthy.

    Deploy

  6. Drag and Drop the "DataValue1" node into the "Data Access View". The value shows 88.

  7. Open your XML file and change the value to -99. The value in UAExpert changes to -99.

Extensions

  1. Try to add other data node with data type System.String on address /Data/Value2.

    Hints

    • You must stop the gateway first
    • Edit the template
    • Reassign the changes to the device
    • Restart the gateway
  2. Change the value of /Data/Value1 to an invalid data, e.g. 88x.

  • What does OPC-UA show?
  • What error is printed out in HumanOS Console?
  1. Add the Write-Flag in Data Access of the "DataNode1". Check if you can change the value on the UAExpert. (Hint: On UAExpert, double click on the data node in "Data Access View").

Further Information

Source Files