Skip to main content

TranslateBrowsePaths

translate_browse_paths The service parses the "BrowsePath string" in batches NodeIdin a single pass RPC; a loop, on resolve the other hand, processes each tag one at a time RPC.

Prerequisite Reading
  • For chained exploration, we recommend using Node Indexer.
  • This is a must-have for batch initializing 100+ paths API.

Signature​

pub fn Session::translate_browse_paths(
&self,
paths: &[(String, String)], // (starting_node_id, browse_path)
) -> Result<Vec<TranslateResult>, OpcUaError>;

TranslateResult field​

pub struct TranslateResult {
/// The result of the parsing is NodeId; an empty string indicates that parsing failed (see status).
pub node_id: String,
/// The path's StatusCode (Good = parsing succeeded).
pub status: StatusCode,
}

impl Display for TranslateResult { /* "NodeId [Status]" or "<failed: Status>" */ }

Usage​

let paths = vec![
("i=85".into(), "/Server/ServerStatus/CurrentTime".into()),
("i=85".into(), "/Server/ServerStatus/State".into()),
("ns=2;s=Boiler1".into(), "/Temperature".into()),
("ns=2;s=Boiler1".into(), "/Pressure".into()),
];

let results = s.translate_browse_paths(&paths)?;
for r in &results {
if r.status.is_good() {
println!("OK: {}", r.node_id);
} else {
println!("Fail: {}", r.status);
}
}

BrowsePath Segment Format​

FormatMeaning
BrowseNamens=0 Default
ns:BrowseNameSpecify NamespaceIndex
/seg1/seg2/seg3Multiple segments, separated by /

Example:

BrowsePathMeaning
/Serverns=0 Child node Server
/2:Boiler1ns=2 Child node Boiler1
/Server/2:Boilers/2:Boiler1/2:TemperatureMulti-layer Combination

Comparison with resolve​

APIRPC Number of timesApplicable
resolve(path)1 (Internal route— TranslateBrowsePaths single track)Occasional use, single path
translate_browse_paths(&paths)1100+ Paths in Bulk
node.child(a).child(b).child(c)N (once per segment Browse)Exploratory

Initializing 100 tags: NodeId Parse them all at once translate_browse_paths in a single batch RPC; resolve if you use a loop, process each tag one at a time RPC (see the table above). The amount of time saved varies depending on your network and server; test it in your own environment to determine the exact savings.

Error Handling​

Overall failure RPC returned Err(OpcUaError). A failure in a single path does not cause the entire request to fail — results[i].status the resolution results for each path are reported independently; an empty node_id string indicates that no node was found for that path.

Next Step​