This Service is used to write values to one or more Attributes of one or more Nodes. For constructed Attribute values whose elements are indexed, such as an array, this Service allows Clients to write the entire set of indexed values as a composite, to write individual elements or to write ranges of elements of the composite.
The values are written to the data source, such as a device, and the Service does not return until it writes the values or determines that the value cannot be written. In certain cases, the Server will successfully write to an intermediate system or Server, and will not know if the data source was updated properly. In these cases, the Server should report a success code that indicates that the write was not verified. In the cases where the Server is able to verify that it has successfully written to the data source, it reports an unconditional success.
The order the operations are processed in the Server is not defined and depends on the different data sources and the internal Server logic. If an Attribute and Node combination is contained in more than one operation, the order of the processing is undefined. If a Client requires sequential processing the Client needs separate Service calls.
It is possible that the Server may successfully write some Attributes, but not others. Rollback is the responsibility of the Client.
If a Server allows writing of Attributes with the DataType LocalizedText, the Client can add or overwrite the text for a locale by writing the text with the associated LocaleId. Writing a null String for the text for a locale shall delete the String for that locale. Writing a null String for the locale and a non-null String for the text is setting the text for an invariant locale. Writing a null String for the text and a null String for the locale shall delete the entries for all locales. If a Client attempts to write a locale that is either syntactically invalid or not supported, the Server returns Bad_LocaleNotSupported. The Write behaviour for Value Attributes with a LocalizedText DataType is Server specific but it is recommended to follow the same rules.
Table 59 defines the parameters for the Service.
Table 59 – Write Service Parameters
Name |
Type |
Description |
Request |
|
|
requestHeader |
RequestHeader |
Common request parameters (see 7.33 for RequestHeader definition). |
nodesToWrite [] |
WriteValue |
List of Nodes and their Attributes to write. This structure is defined in-line with the following indented items. |
nodeId |
NodeId |
NodeId of the Node that contains the Attributes. |
attributeId |
IntegerId |
Id of the Attribute. This shall be a valid Attribute id. The IntegerId is defined in 7.19. The IntegerIds for the Attributes are defined in OPC 10000-6. |
indexRange |
NumericRange |
This parameter is used to identify a single element of an array, or a single range of indexes for arrays. The array in this context includes String and ByteString. The first element is identified by index 0 (zero). The NumericRange type is defined in 7.27. This parameter is not used if the specified Attribute is not an array. However, if the specified Attribute is an array and this parameter is not used, then all elements are to be included in the range. The parameter is null or empty if not used. A Server shall return a Bad_WriteNotSupported error if an indexRange is provided and writing of indexRange is not possible for the Node. |
value |
DataValue |
The Node’s Attribute value (see 7.11 for DataValue definition). If the indexRange parameter is specified then the Value shall be an array even if only one element is being written. If the SourceTimestamp or the ServerTimestamp is specified, the Server shall use these values. The Server returns a Bad_WriteNotSupported error if it does not support writing of timestamps. A Server shall return a Bad_TypeMismatch error if the data type of the written value is not the same type or subtype of the Attribute’s DataType. Based on the DataType hierarchy, subtypes of the Attribute DataType shall be accepted by the Server. Servers may reject subtypes defined in newer specification versions than supported by the Server with Bad_TypeMismatch. For the Value Attribute the DataType is defined through the DataType Attribute. A ByteString is structurally the same as a one dimensional array of Byte. A Server shall accept a ByteString if an array of Byte is expected. The Server returns a Bad_DataEncodingUnsupported error if it does not support the provided data encoding. Simple DataTypes (see OPC 10000-3) use the same representation on the wire as their super types and therefore writing a value of a simple DataType cannot be distinguished from writing a value of its super type. The Server shall assume that by receiving the correct wire representation for a simple DataType the correct type was chosen. Servers are allowed to impose additional data validations on the value independent of the encoding (e.g. having an image in GIF format in a ByteString). In this case the Server shall return a Bad_TypeMismatch error if the validation fails. |
|
|
|
Response |
|
|
responseHeader |
ResponseHeader |
Common response parameters (see 7.34 for ResponseHeader definition). |
results [] |
StatusCode |
List of results for the Nodes to write (see 7.39 for StatusCode definition). The size and order of the list matches the size and order of the nodesToWrite request parameter. There is one entry in this list for each Node contained in the nodesToWrite parameter. |
diagnosticInfos [] |
DiagnosticInfo |
List of diagnostic information for the Nodes to write (see 7.12 for DiagnosticInfo definition). The size and order of the list matches the size and order of the nodesToWrite request parameter. This list is empty if diagnostics information was not requested in the request header or if no diagnostic information was encountered in processing of the request. |
Table 60 defines the Service results specific to this Service. Common StatusCodes are defined in Table 182.
Table 60 – Write Service Result Codes
Symbolic Id |
Description |
Bad_NothingToDo |
See Table 182 for the description of this result code. |
Bad_TooManyOperations |
See Table 182 for the description of this result code. |
Table 61 defines values for the results parameter that are specific to this Service. Common StatusCodes are defined in Table 183.
Table 61 – Write Operation Level Result Codes
Symbolic Id |
Description |
Good_CompletesAsynchronously |
See Table 182 for the description of this result code. The value was successfully written to an intermediate system but the Server does not know if the data source was updated properly. |
Bad_NodeIdInvalid |
See Table 183 for the description of this result code. |
Bad_NodeIdUnknown |
See Table 183 for the description of this result code. |
Bad_AttributeIdInvalid |
See Table 183 for the description of this result code. |
Bad_IndexRangeInvalid |
See Table 183 for the description of this result code. It is also used if writing of IndexRange is supported in general for a Node but the passed IndexRange cannot be written by the Server. |
Bad_IndexRangeNoData |
See Table 183 for the description of this result code. |
Bad_IndexRangeDataMismatch |
The data to be written does not match the IndexRange. |
Bad_WriteNotSupported |
The requested write operation is not supported. If a Client attempts to write any value, status code, timestamp combination and the Server does not support the requested combination (which could be a single quantity such as just timestamp); than the Server shall not perform any write on this Node and shall return this StatusCode for this Node. It is also used if writing of IndexRanges is not supported for a Node. |
Bad_NotWritable |
See Table 183 for the description of this result code. |
Bad_UserAccessDenied |
See Table 182 for the description of this result code. The current user does not have permission to write the attribute. |
Bad_OutOfRange |
See Table 183 for the description of this result code. If a Client attempts to write a value outside the valid range like a value not contained in the enumeration data type of the Node, the Server shall return this StatusCode for this Node. This result code can be returned for any value that has the right DataType but does not comply with the restrictions defined by the Server implementation e.g. if a written String contains unsupported characters. |
Bad_TypeMismatch |
See Table 183 for the description of this result code. |
Bad_DataEncodingUnsupported |
See Table 183 for the description of this result code. |
Bad_NoCommunication |
See Table 183 for the description of this result code. |
Bad_LocaleNotSupported |
The locale in the requested write operation is not supported. |