Version 3.1.8

This is a bug fix release of the SDK. It also contains a few new features.

The scenario of a server without any certificates (for NONE SecurityMode Endpoints only) mentioned in the server tutorial does not work. Only client side works without a cert (if connected on NONE SecurityMode and Anonymous user authentication mode). We try to make this available in a future SDK version for the server side as well. Also it should be noted that a certificate is recommended anyway to be interoperable with UA 1.01 Clients as the option to not send it was added in UA 1.02. Server tutorial text was updated for this version (the scenario removed from the text).

OPC Foundation Java Stack changes

Using version 1.3.346, which has following changes:

  • Fixed GH#167: Removed redundant Message size calculation in TcpConnection.encodeMessage

  • Fixed: Added .setProvider("BC") to BouncyCastleUtils.writeToPem as in others methods of that class

Changes to SDK common classes

  • New: TypeDictionary.setWarnOnlyOnErroneousDictionaries(…​), can be used to ignore invalid dictionaries for servers failing to provide proper inverse references back to DataType nodes.

  • Deprecated: DefaultUaCertificateValidator. This was missed earlier when the implemented interface UaCertificateValidator was deprecated in 3.0.0, see Version 3.0.0 for more information.

  • Fixed: MonitoredItemBase.hashCode, no longer uses clientHandle/monitoredItemId when calculating the hashCode. Fixes an issue where it would change after the item is recreated on a server that is restarted.

Changes to Client SDK

  • New: Following overloads that do a best-effort conversion to the correct DataType of the node (or Attribute) using DataTypeConverter. Currently it supports conversion for the same types as DataTypeConverter does, for others DataTypeConversionException is thrown.

    • UaClient.writeAttribute(NodeId nodeId, UnsignedInteger attributeId, Object value, boolean autoConvert) (does a Read call for the DataType if Value Attribute)

    • Uaclient.writeValue(NodeId nodeId, Object value, boolean autoConvert) (does a Read call for the DataType)

    • UaVariableImpl.writeValue(final Object value, final boolean autoConvert) (uses DataType from the node)

  • New: UaClient.setDefaultMaxAge(…​) can be set to override the default value of Integer.MAX_VALUE (as double), used in readXXX methods (for the MaxAge Read parameter) that do not specifically have that as an option.

    A future major version of the SDK will most likely change the default value to 0 from the Integer.MAX_VALUE as it is more correct and the current can cause problems when connecting to certain servers. The current default value was kept to be backwards compatible within 3.1.x versions.
  • New: UaClient.setDefaultTimestampsToReturn(..) can be set to override the default TimestampsToReturn.Both used in readXXX methods (for the TimestampsToReturn Read parameter) that do not specifically have that as an option

  • Fixed: protected UaViewImpl.readAttribute now handles ContainsNoLoops Attribute (previously Bad_AttributeIdInvalid was thrown)

  • Fixed/Workaround: Disabled Cert equals check (between GetEndpoints and CreateSessionResponse) if used SecurityMode is NONE. Avoids an error in a scenario of server having multiple SecurityMode NONE Endpoints.

Changes to Server SDK

  • Fixed/Workaround: If multiple certificates defined together with NONE SecurityMode, for each an Endpoint is created. If client does not send certificate and thus the Asymmetric algorithm is empty in the Security header, there is no practical way to recognize which one of the NONE Endpoints client did use, and it is not possible to send the correct certificate in CreateSessionResponse. Following changes:

    • If it is not possible to determine the Cert of the Endpoint the client did use, construct ServerUserIdentity with all of the certificates. Fixes ActivateSession username/password decryption problems.

    • Additionally the first Cert is used for the CreateSessionResponse (existing implementation).

Changes to Code Generator

  • New: Added option to exclude sub-nodes under a Type from generation to avoid name clashes, see the codegen manual for more information.

  • New: If a Node is missing a SymbolicName and BrowseName is not suitable as a code name, logs WARNings and guess a suitable name (by removing characters that cannot be used from the BrowseName).

  • Fixed: Ignoring HasTypeDefinition references for Method nodes (Not allowed by the specification, see 1.04 Part 3 section 7.13), outputs WARN logs so that models can be fixed

  • Fixed: Ignoring forward references pointing to the node itself when generating subpaths for Ids class output (previously OutOfMemoryError would happen as it was infinite loop)

  • Fixed: Halt generation if multiple types within same namespace would resolve to the same fully-qualified java class name.

  • Fixed: Ignores (with WARN logs) namespaces defined in the NamespaceUris block that are not actually used by the model (if no model was found for such namespace).

  • Fixed: Now supports generating models that do not define "Default XML" encodings for Structures. Note that this is experimental and also prevents loading said Structure values from the model if defined.

Changes to SampleConsoleClient

Changes to SampleConsoleServer

Other

  • Using Structure.clone directly instead of via reflection in StructureUtils.clone and when synchronizing Structure parts to sub-nodes in the server side, can improve performance in some cases.

Version 3.1.6

This is a new bug fix release of the SDK.

Also the release notes has new look and feel and contains notes for all releases in a single document (per major version).

OPC Foundation Java Stack changes

Using version 1.3.345, which has following changes:

  • Fixed: GH#83 Fixed NPE if equals was called for lazily encoded ExtensionObject

  • Fixed: GH#150 First tcp message "UA Hello" was segmented, added buffering to avoid tcp fragments of one byte

  • Fixed: GH#154 ErrorMessage was sent twice during forming secure channel if there was errors, caused problems vs. Foundation C-stack

  • Fixed: GH#155 BinaryDecoder.getExpandedNodeId failed for standard numeric ids in range 128-255, which caused problems interacting with some 1.04 servers.

  • Fixed: ExpandedNodeId.toString uses 'svr' instead of 'srv' for server index output. This is expected by ExpandedNodeId.parseExpandedNodeId and is also the specificed as such in the XML encoding for ExpandedNodeId.

  • Improved: logging and allowing override for logic added in 1.3.344 for disabling the DTD procesing in XML

  • New: static TcpConnection.setDefaultHandshakeTimeout which can be used to set a lower timeout default for the initial connection from the default 60000 (milliseconds)

    Operating System settings influences the maximum possible value, in practice it would see to be at max 20 seconds on e.g. Windows defaults.

Changes to SDK common classes

  • Fixed: ApplicationIdentity multiple calls with default cert size 0 uses correct size, also allows 0 to be any of the parameter positions.

Changes to Client SDK

  • New: UaClient.setValidateCreateSessionResponseCert, which can be set to false (default true) to disable certificate equals check (GetEndpoints vs. CreateSessionResponse) when connecting. Should be only done if needed and operating in a closed network and the server is known to be safe (but behaves incorrectly).

  • Fixed: Certificate mismatch error (GetEndpoints vs. CreateSessionResponse) when server returns a certificate chain.

Changes to Server SDK

  • Fixed: Servers with more than one Certificate now sends the correct one in CreateSessionResponse

  • Fixed: Possible NPE if a Subscription is being deleted if at the same time an operation for it (e.g. adding items) is still running.

Changes to Code Generator

  • New: ServerInformationModel.getLocationURI method is generated, which will return URI pointing to the NodeSet2 XML.

    Assumes the NodeSet2 file is found on the classpath next to the generated ServerInformationModel class file, this is the default for NodeSets bundled with the SDK. Throws RuntimeException if the file is not found.
    Use server_model codegen target to automatically copy the NodeSet2 file to correct location during generation
  • Changed: Generated static encoding fields for Structures are now marked as final as they should not change

  • Improved: Commandline configuration files now support property-replacing all parameters

Changes to SampleConsoleClient

  • No changes

Changes to SampleConsoleServer

  • Improved: SampleConsoleServer.loadInformationModels shows different ways to register generated code classes and loading the model NodeSet2 XMLs

  • Changed: IPv6 is now enabled by default if running on Java 7+ (Java 6 does not support IPv6)

Version 3.1.4

This is a new bug fix release of the SDK. It also includes important security fixes.

OPC Foundation Java Stack changes

Using version 1.3.344, which has following fixes:

  • SECURITY FIX: Prevent accessing external resources with XMLs

  • SECURITY FIX: Additional logic for catching StackOverflowErrors during message decoding

  • Fixed GH#112: Binary encoding of DataValue with picoseconds

  • Fixed GH#144: Removed 'assert' checks in SerializerComposition

  • Fixed GH#145: Calculation of certificate thumbprint, when a certificate chain is received

  • Fixed GH#146: XmlDecoder.getExtensionObject() passes NamespaceTable and fixes the mapping of NamespaceIndexes with the table of the EncoderContext

Changes to SDK common classes

  • New: ApplicationIdentity.setApplicationDescription() takes an optional parameter 'enableValidation'

Changes to Client SDK

  • SECURITY FIX: Validate server certificate, if 1. Connected with SecurityMode None AND 2. Server did send a certificate AND 3. Connecting with UserTokenPolicy that requires encryption

  • Fixed: Do not auto-replace 'localhost' when receiving the server’s ApplicationUri (Servers should not define such ApplicationUris, though)

  • Fixed: Avoid StackOverflowError if a Method has a TypeDefinition Reference to itself (NOTE! Some servers use TypeDefinitions for Methods, although the specification does not allow that)

  • Fixed: UaClient.getServerIdentity() returned null when connected to servers that do not send a certificate for SecurityMode None

Changes to Server SDK

  • SECURITY FIX: Validate that padding bytes are 0 after encrypted user token designated length

  • SECURITY FIX: Prevent possible attack scenarios when decrypting user tokens

  • Fixed: Empty UserIdentityToken was not handled correctly. It is now interpreted as Anonymous token as defined in the ActivateSession in spec. Part 4

  • Fixed: Loading a NodeSet2 XML with nodes having more than one inverse Reference of certain ReferenceTypes

    This has the side-effect for the following method in NodeManager:

    protected NodeId addNode(ServiceContext serviceContext, NodeId nodeId, NodeId parentNodeId, QualifiedName browseName, NodeClass nodeClass, ExpandedNodeId typeDefinitionId, NodeAttributes attributes, NodeId referenceTypeId)

    Now the parameters parentNodeId and NodeId are always null when adding nodes from a NodeSet2 XML, and the so called "parent-reference" is added as a normal reference via addReference()

Changes to Code Generator

  • Fixed: Empty Structure arrays were not converted to the actual type for Method output parameters.

We recommend regenerating code with 3.1.4 codegen, if you have methods that define an array of some Structure type as their output argument

Changes to SampleConsoleClient

  • No changes

Changes to SampleConsoleServer

  • No changes

Version 3.1.2

This is a new bug fix release of the SDK.

Main fixes are for the TypeDictionary system introduced in 3.0.0 for handling unknown custom Structures and for generated code for custom Structures having array fields.

OPC Foundation Java Stack changes

No changes, using version 1.3.343 (same as in SDK 3.0.0 and 3.1.0)

Changes to common classes

  • Fixed: StructureUtils.clone helper for generated code now properly deep-clones arrays instead of logging errors, this affected generated code for custom Structures that have array fields. Note that also the bundled generated code for the DI and GDS companion specification information models were affected.

Changes to Client SDK

  • Fixed: DynamicStructure.hashCode and equals now works properly, previously was incorrect if DynamicStructure had array fields

  • Fixed: DynamicStructure.clone is now implemented, array fields are deep-cloned

Changes to Server SDK

  • Fixed: When creating instances of a VariableType that has a non-null Structure as Value, the parts of the Structure are set correctly to the created sub-nodes for the Variable during NodeManagerUaNode.createInstance.

Code Generator

  • Fixed: TypeDefinitionId annotation is generated for Structures and Enumerations. This affected sub-node creation for Variable nodes with custom Structures having custom Enumeration fields.

  • Fixed: Generated code for handling Union deserialization now handles null, i.e. SwitchField value is 0, situation correctly.

  • Fixed: Generating Ids on model with large number of types will split the initialization to multiple files (if over 3000 NodeIds at the moment) to avoid "Code too large" compilation errors. Public API of the generated Ids java file is the same, this only affect internal initialization.

We recommend regenerating code with 3.1.2 codegen.

Changes to SampleConsoleClient sample

  • No changes

Changes to SampleConsoleServer sample

  • No changes

Version 3.1.0

This is a new minor release of the SDK. Most of the changes are related to the TypeDictionary system introduced in SDK 3.0.0.

This release adds support for custom Enumeration fields for custom Structures obtained from TypeDictionary. It also enables support for several TypeDictionaries per namespace, which is allowed by the OPC UA specification.

OPC Foundation Java Stack changes

  • No changes, using version 1.3.343 (same as in SDK 3.0.0)

Changes to both the Client and Server SDKs

  • Fixed: UaAddress now handles URIs with '.local.' parts (by removing the final '.' after 'local'), which the new OPC Foundation Local Discovery Server (LDS-ME) provides as response to FindServersOnNetwork requests

  • Fixed: UaNodeId.from(namespace, value) now accepts also Integer as value - in addition to UnsignedInteger and the other valid types

  • Improved: ApplicationIdentity.getActualHostName() & getActualHostNameWithoutDomain() cache the resolved local hostname

Changes to Client SDK

  • Fixed: Support several TypeDictionaries per namespace

  • Interface Change: DataTypeDictionary.supportedNamespaceUris() removed, added DataTypeDictionary.knownAddressSpaceNamespaces() and DataTypeDictionary.supportedDictionaryTargetNamespaces()

  • Interface Change: Added fields to the FieldSpecification constructor

  • New: TypeDictionary supports custom Structures that have custom Enumerations

  • New: FieldSpecification.getDataTypeId() can be used to obtain the UA DataType of the custom Structure field

  • New: DynamicEnumeration, EnumerationSpecification; Used for custom Enumeration fields of custom Structures

Changes to Server SDK

  • No changes

Code Generator

  • Fixed: Support several TypeDictionaries per namespace. Namespaces that have several type dictionaries require new code generation.

Changes to SampleConsoleClient

  • No changes

Changes to SampleConsoleServer

  • No changes

Version 3.0.0

This is a new major release of the SDK. It has some major modifications and changes to the previous version 2.x, but old projects can be migrated with little effort to this version. Please see the Migration Guide for details.

Feature Highlights:

  • Support for OPC UA version 1.03

  • Rewritten, improved Code Generator

OPC Foundation Java Stack changes

  • Version: 1.3.343

  • Changed: OPC UA ByteString is now mapped to org.opcfoundation.ua.builtintypes.ByteString instead of byte[] in all interfaces.

  • New: DefaultCertificateValidator & PkiDirectoryCertificateStore (replacing the PkiFileBasedCertificateValidator in the SDK)

Changes to both the Client and Server SDKs

  • New: ApplicationIdentity.getHostNameWithoutDomain().

  • New: Support for (a subset of) OPC UA Aggregates (UaClient.getAggregateCalculator() and UaServer.getAggregateCalculator()).

  • New: Support for the Global Discovery Server (GDS) information model.

  • Changed: Using OPC UA 1.03 information model.

  • Changed: AnalogItemType.getEuRange() changed to .getEURange().

  • Fixed: UaType.getJavaClass() for StatusCode.

  • Fixed: UaType.getJavaClass() for Structures (assuming they are code generated with the new Code Generator).

  • Deprecated: PkiFileBasedCertificateValidator and UaCertificateValidator; replaced by the stack classes DefaultCertificateValidator & PkiDirectoryCertificateStore (see the Tutorials for details).

Changes to Client SDK

  • New: TypeDictionary class, which can be used to decode custom Structure types that are not known at compile time. NOTE: Custom Enumeration fields not supported, yet.

  • New: AddressSpace.getNodes(); Similar to getNode() but offers better performance when retrieving several nodes at once.

  • Changed: UaClient.doRead() is now protected (was public unintentionally)

  • Changed: UaNodeImpl.getForwardReferences() and getInverseReferences() return all References instead of no References when empty varargs parameter is passed.

  • Fixed: Recovery of Subscriptions after a connection break longer of than the keepAlive time but shorter than lifeTime

  • Removed: FileSyncClient (see end of the notes for details).

Changes to Server SDK

  • Improved: Node instantiation has been improved along wit the new code generation. This enables handling of more complex situations also in future.

  • New: TypeDefinitionBasedNodeBuilderConfiguration class. An alternative and improved way for configuring InstanceDeclarations with Optional ModellingRules for instantiation.

  • New: Updating CurrentTime in ServerStatus once per second (required for clients that create a MonitoredItem instead of using a periodic read).

  • New: Support for the new ConditionRefresh2 Method defined in the OPC UA Specification.

  • New: UaNodeId, UaBrowsePath and UaQualifiedName that use a NamespaceURI instead of a NamespaceIndex (that is used by NodeId, BrowsePath and QualifiedName).

  • New: IoManagerAdapter.

  • New: UaNode.addReference(ExpandedNodeId) enabling external references

  • Changed: AddNodes service call from clients creates full instances for Object and Variable NodeClasses (using the NodeBuilder of the respective NodeManagerUaNode).

  • Changed: Bundled NodeSet2 XML files are now located in the same package as the generated ServerInformationModel class is.

  • Changed: Passing an empty array instead of null for CallableListeners of MethodManagerUaNode.

  • Changed: UaServer logs the message "UaServer closed." during server close to logger instead of system out.

  • Removed: NodeManagerTable.historyRead(ServiceContext, …​) and historyUpdate(ServiceContext, …​)

  • Changed: All instantiation related classes (NodeBuilder and related classes) are moved to the package 'com.prosysopc.ua.server.instantiation'.

  • Fixed: NPE problems and data errors related to Diagnostics.

  • Fixed: Default ValueRank while loading NodeSet2 XML files (using the default ValueRank Scalar (-1) as defined in the XML schema instead of Any (-2)).

  • Fixed: Loading of IsAbstract Attribute for ReferenceTypes from NodeSet2 XMLs.

  • Fixed: Possible memory leak in LocalizedTextMap.

  • Fixed: Writing to Condition node properties didn’t work.

  • Changed/Fixed: LocalizedTextMap. Empty locale is treated the same as null locale. Fixed situation where LocalizedText with null or empty locale could not be replaced. Using overwrite rules of the Specification (v1.03) Part 4 section 5.10.4.1.

  • Changed/Fixed: StructureChanged bit not set anymore on DataType, ValueRank or ArrayDimensions change (changed in OPC UA 1.01 → 1.02).

  • Moved: FileNodeManager and FileFolderType to SampleConsoleServer example.

  • Moved: Compliance nodes moved to SampleConsoleServer

  • Changed: FileFolderType extends new FileDirectoryType (introduced in OPC UA 1.03)

Code Generator

  • New completely rewritten version; generated classes are mostly similar to the old ones, but there are some additions and changes so a regeneration is required.

  • IMPORTANT: the new Code Generator overrides any existing file it generates.

  • IMPORTANT: Running the Code Generator requires Java 7 (generated classes compile and work on Java 6).

  • New: Generated Ids contain NodeIds for ReferenceTypes.

  • New: Generated Ids contain NodeIds for all sub-nodes of the types.

  • New: Support copying the source XML next to the generated classes.

  • New: An optional prefix to use for the generated class names of Ids, ClientInformationModel and ServerInformationModel (for example to generate DiIds, etc.).

  • New: Enable implementation of UA methods and initialization external to the generated classes (to avoid editing the generated classes).

  • New: Support for Unions and Optional Structures.

  • New: Experimental Maven plugin.

  • Changed: Using Prefixes Di, Adi, Plc, Gds for the bundled companion specifications (the standard namespace does not have a prefix).

  • Changed: InformationModel classes renamed to ClientInformationModel on the client side and ServerInformationModel on the server side.

  • Changed: Generating Parameter Objects for UA Methods having more than one OutputArgument.

  • Changed: Client-side async method calls return correct generic parameter (AsyncResult for methods returning none).

  • Changed: getter and setter names for type components use actual names: e.g. AnalogItemType.getEuRange() changed to .getEURange().

Changes to SampleConsoleClient

  • Fixed: Problems initializing logging if log file path contained spaces.

  • Changed: Uses certificate validation from the Stack classes.

Changes to SampleConsoleServer

  • Fixed: Problems initializing logging if log file path contained spaces.

  • Moved: The compliance nodes are now directly a part of the samples instead of the SDK.

  • Moved: FileNodeManager and FileFolderType moved as sample implementation out of the main SDK

  • Changed: Uses certificate validation from the Stack classes.

  • Removed: MyLevelAlarmType class (was not used anywhere).

More

  • The SDK and Stack jar names have changed slightly due to changes in build processes.

  • Compliance nodes that were used in the SampleConsoleServer are moved from the SDK to the samples. The original idea was that you could just include ComplianceNodeManager for your server in order to help for the certification process, however in practice that only works for the samples as you need to use the actual nodes of your server. Therefore the related classes are moved to samples.

  • FileNodeManager and related classes are also moved to be a part of the SampleConsoleServer as the implementation is too application specific and serves better as a sample and a starting point for servers requiring similar functionality.

  • FileSyncClient class is removed due to the functionality being too unreliable and application specific. If the removal is a problem, let us know.