`dump:nodeset`
Export a live server's namespace to a NodeSet2.xml file. Reverse of generate:nodeset — start from the server, end with a file you can feed to the code generator.
Walk a server's address space and emit a NodeSet2.xml.
Usage
opcua-cli dump:nodeset <endpoint> --output=<file.xml> [--namespace=<index>] [global-options]
| Argument | Meaning |
|---|---|
<endpoint> |
The OPC UA server URL. Required. |
| Option | Default | Effect |
|---|---|---|
--output=PATH |
required | Output file path (.xml) |
--namespace=N |
all non-zero namespaces | Dump only namespace index N |
Connects to the server, browses recursively, reads node attributes in batches, writes them as a NodeSet2.xml.
Examples
Dump everything
opcua-cli dump:nodeset opc.tcp://plc.local:4840 --output=PLC.NodeSet2.xml
Walks every node in every non-zero namespace. On a server with 50 000 nodes this takes a few minutes; the output file is megabytes.
Dump a single namespace
opcua-cli dump:nodeset opc.tcp://plc.local:4840 --output=PLC-ns2.NodeSet2.xml --namespace=2
Most production deployments care only about the vendor's custom
namespace (typically 2). Filter to it for a much smaller dump.
Then generate from it
# 1. Export from the server
opcua-cli dump:nodeset opc.tcp://plc.local:4840 \
--output=MyPLC.NodeSet2.xml --namespace=2
# 2. Generate PHP types from the dump
opcua-cli generate:nodeset MyPLC.NodeSet2.xml \
--output=src/Generated/MyPLC/ \
--namespace="App\\OpcUa\\MyPLC"
# 3. Use in your code (loadGeneratedTypes)
This is the canonical "server has no published NodeSet2.xml" workflow. See Code generation · Dump from a server.
What ends up in the XML
The dump captures:
- Nodes — every node visited, with NodeId, BrowseName, DisplayName, Description, NodeClass.
- Attributes — DataType, ValueRank, AccessLevel, Historizing, IsAbstract, etc. (per the OPC UA Attribute catalogue).
- References — every HasComponent, HasProperty, HasTypeDefinition, Organizes, … pointing out of each node.
- Aliases — namespace 0 well-known references referenced by
the dumped nodes (e.g.
HasComponent = i=47). - Required models — declares the spec's namespace URIs the dump depends on.
What the dump does not capture:
- Node values. The dump records structure, not runtime values. A node's Value attribute is not dumped (it changes continuously).
- Custom DataType definitions that the server has not
itself encoded as standard
DataTypeDefinitionattributes. The generator can still produce NodeId constants and enums, but custom structures may need manual work.
How it interacts with auto-generation
The XML the dump produces is plain NodeSet2 — feed it to
generate:nodeset and the output is regular generated PHP.
This is how you get typed PHP for a server whose vendor never
published a NodeSet2.xml.
How it maps to the library
| You ran | The CLI does |
|---|---|
dump:nodeset <endpoint> --output=… |
$client->browseRecursive(...) + per-node single-attribute read() calls (DataType, ValueRank, IsAbstract, Symmetric, DataTypeDefinition) + NodeSetXmlBuilder::build(...) |
The internal flow is browse-then-read-then-build. Each attribute
read is a separate read() call — there is no readMulti() batch
here. For very large address spaces, the per-node read step
dominates the runtime.
When to use it
- Vendor-specific PLC with no published spec. Dump, generate, use the generated PHP types in your application.
- Reverse-engineering a new server. A grep-able XML is
easier to inspect than running
browse --recursiverepeatedly. - Snapshot for testing. Dump once; replay in a test environment against a faked server that serves the same shape.
- Documentation. The XML can be diffed across firmware revisions to track namespace changes.
What the XML is not good for
- Live values. Use
read,watch, or subscriptions. - Method call signatures. Methods are nodes (dumped), but
their
InputArguments/OutputArgumentsproperties are ExtensionObjects — the dump captures them but they may decode incompletely. - As-published spec. A dump is what this specific server publishes, which may differ from the OPC Foundation's canonical spec.
Common pitfalls
- Output file overwritten silently. No confirmation prompt. Don't dump on top of a file you wanted to keep.
- Long-running on huge address spaces. Plan for it — a
50 000-node server takes minutes. Use
--namespace=Nto narrow. - Server times out. Some servers limit per-session operation count. If the dump fails partway, narrow the namespace filter and run multiple dumps.
- The dump captures attribute values you might not expect.
ValueRank, ArrayDimensions, AccessLevel — these are static-
per-node and useful. But
MinimumSamplingIntervalis also captured and may surprise you.