Added JSON Reversible encoding

Signed-off-by: Akos Makovics <akos.makovics@sigmatechnology.se>
diff --git a/src/OpcUa_Functions_JSON.ttcn b/src/OpcUa_Functions_JSON.ttcn
new file mode 100644
index 0000000..a547c42
--- /dev/null
+++ b/src/OpcUa_Functions_JSON.ttcn
@@ -0,0 +1,623 @@
+/////////////////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2017-2018  Ericsson AB
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+/////////////////////////////////////////////////////////////////////////////////////
+// Contributors:
+// Akos Makovics
+//
+//  File:         OpcUa_Functions_JSON.ttcn
+//  Rev:          <RnXnn>
+//  Prodnr:       CNL113861
+/////////////////////////////////////////////////////////////////////////////////////
+
+module OpcUa_Functions_JSON {
+
+  import from OpcUa_Types_JSON_Reversible all;
+
+  function f_CalculateSize(in MessageTypes pl_in) return integer {
+    var octetstring encoded := enc_MessageTypes(pl_in);
+
+    return lengthof(encoded);
+  }
+
+  function f_ObjectAttributes_PreProcess (inout ObjectAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.eventNotifier != omit) {
+      mask := mask + 4;
+
+      if (pl_in.eventNotifier == 0) {
+        pl_in.eventNotifier := omit;
+      }
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 8;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 16;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+  }
+
+  function f_ObjectAttributes_PostProcess (inout ObjectAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 8);
+
+    if (mask[3] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[4] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    if (mask[5] == '1'B and pl_in.eventNotifier == omit) {
+      pl_in.eventNotifier := 0;
+    }
+  }
+
+  function f_VariableAttributes_PreProcess (inout VariableAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.Value != omit) {
+      mask := mask + 4;
+
+      if (pl_in.Value == 0) {
+        pl_in.Value := omit;
+      }
+    }
+
+    if (pl_in.dataType != omit) {
+      mask := mask + 8;
+    }
+
+    if (pl_in.valueRank != omit) {
+      mask := mask + 16;
+
+      if (pl_in.valueRank == 0) {
+        pl_in.valueRank := omit;
+      }
+    }
+
+    if (pl_in.arrayDimensions != omit) {
+      mask := 32;
+    }
+
+    if (pl_in.accessLevel != omit){
+      mask := mask + 64;
+
+      if (pl_in.accessLevel == 0) {
+        pl_in.accessLevel := omit;
+      }
+    }
+
+    if (pl_in.userAccessLevel != omit) {
+      mask := mask + 128;
+
+      if (pl_in.userAccessLevel == 0) {
+        pl_in.userAccessLevel := omit;
+      }
+    }
+
+    if (pl_in.minimumSamplingInterval != omit) {
+      mask := mask + 256;
+    }
+
+    if (pl_in.historizing != omit) {
+      mask := mask + 512;
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 1024;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 2048;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_VariableAttributes_PostProcess (inout VariableAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 12);
+    log (mask);
+
+
+    if (mask[0] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[1] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    if (mask[4] == '1'B and pl_in.userAccessLevel == omit) {
+      pl_in.userAccessLevel := 0;
+    }
+
+    if (mask[5] == '1'B and pl_in.accessLevel == omit) {
+      pl_in.accessLevel := 0;
+    }
+
+    if (mask[7] == '1'B and pl_in.valueRank == omit) {
+      pl_in.valueRank := 0;
+    }
+
+    if (mask[9] == '1'B and pl_in.Value == omit) {
+      pl_in.Value := 0;
+    }
+
+    log (pl_in);
+  }
+
+  function f_MethodAttributes_PreProcess (inout MethodAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.executable != omit) {
+      mask := mask + 4;
+    }
+
+    if (pl_in.userExecutable != omit) {
+      mask := mask + 8;
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 16;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 32;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_MethodAttributes_PostProcess (inout MethodAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 6);
+    log (mask);
+    log (mask[0]);
+    log (mask[1]);
+
+    if (mask[0] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[1] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    log (pl_in);
+  }
+
+  function f_ObjectTypeAttributes_PreProcess (inout ObjectTypeAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.isAbstract != omit) {
+      mask := mask + 4;
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 8;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 16;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_ObjectTypeAttributes_PostProcess (inout ObjectTypeAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 5);
+
+    if (mask[0] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[1] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    log (pl_in);
+  }
+
+  function f_VariableTypeAttributes_PreProcess (inout VariableTypeAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.Value != omit) {
+      mask := mask + 4;
+
+      if (pl_in.Value == 0) {
+        pl_in.Value := omit;
+      }
+    }
+
+    if (pl_in.dataType != omit) {
+      mask := mask + 8;
+    }
+
+    if (pl_in.valueRank != omit) {
+      mask := mask + 16;
+
+      if (pl_in.valueRank == 0) {
+        pl_in.valueRank := omit;
+      }
+    }
+
+    if (pl_in.arrayDimensions != omit) {
+      mask := 32;
+    }
+
+    if (pl_in.isAbstract != omit){
+      mask := mask + 64;
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 128;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 256;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_VariableTypeAttributes_PostProcess (inout VariableTypeAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 9);
+    log (mask);
+
+
+    if (mask[0] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[1] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    if (mask[4] == '1'B and pl_in.valueRank == omit) {
+      pl_in.valueRank := 0;
+    }
+
+    if (mask[6] == '1'B and pl_in.Value == omit) {
+      pl_in.Value := 0;
+    }
+
+    log (pl_in);
+  }
+
+  function f_ReferenceTypeAttributes_PreProcess (inout ReferenceTypeAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.isAbstract != omit) {
+      mask := mask + 4;
+    }
+
+    if (pl_in.symmetric != omit) {
+      mask := mask + 8;
+    }
+
+    if (pl_in.inverseName != omit) {
+      mask := mask + 16;
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 32;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 64;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_ReferenceTypeAttributes_PostProcess (inout ReferenceTypeAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 7);
+    log (mask);
+
+
+    if (mask[0] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[1] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    log (pl_in);
+  }
+
+  function f_DataTypeAttributes_PreProcess (inout DataTypeAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.isAbstract != omit) {
+      mask := mask + 4;
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 8;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 16;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_DataTypeAttributes_PostProcess (inout DataTypeAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 5);
+    log (mask);
+
+
+    if (mask[0] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[1] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    log (pl_in);
+  }
+
+  function f_ViewAttributes_PreProcess (inout ViewAttributes pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.displayName != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.description != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.containsNoLoops != omit) {
+      mask := mask + 4;
+    }
+
+    if (pl_in.eventNotifier != omit) {
+      mask := mask + 8;
+
+      if (pl_in.eventNotifier == 0) {
+        pl_in.eventNotifier := omit;
+      }
+    }
+
+    if (pl_in.writeMask != omit) {
+      mask := mask + 16;
+
+      if (pl_in.writeMask == 0) {
+        pl_in.writeMask := omit;
+      }
+    }
+
+    if (pl_in.userWriteMask != omit) {
+      mask := mask + 32;
+
+      if (pl_in.userWriteMask == 0) {
+        pl_in.userWriteMask := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_ViewAttributes_PostProcess (inout ViewAttributes pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 6);
+    log (mask);
+
+
+    if (mask[0] == '1'B and pl_in.userWriteMask == omit) {
+      pl_in.userWriteMask := 0;
+    }
+
+    if (mask[1] == '1'B and pl_in.writeMask == omit) {
+      pl_in.writeMask := 0;
+    }
+
+    if (mask[2] == '1'B and pl_in.eventNotifier == omit) {
+      pl_in.eventNotifier := 0;
+    }
+
+    log (pl_in);
+  }
+
+  function f_DataValue_PreProcess (inout DataValue pl_in) {
+    var integer mask := 0;
+
+    if (pl_in.Value != omit) {
+      mask := 1;
+    }
+
+    if (pl_in.Status != omit){
+      mask := mask + 2;
+    }
+
+    if (pl_in.SourceTimeStamp != omit) {
+      mask := mask + 4;
+    }
+
+    if (pl_in.SourcePicoSecond != omit) {
+      mask := mask + 8;
+
+      if (pl_in.SourcePicoSecond == 0) {
+        pl_in.SourcePicoSecond := omit;
+      }
+    }
+
+    if (pl_in.ServerTimestamp != omit) {
+      mask := mask + 16;
+    }
+
+    if (pl_in.ServerPicoSeconds != omit) {
+      mask := mask + 32;
+
+      if (pl_in.ServerPicoSeconds == 0) {
+        pl_in.ServerPicoSeconds := omit;
+      }
+    }
+
+    pl_in.EncodingMask := mask;
+
+    log (pl_in);
+  }
+
+  function f_DataValue_PostProcess (inout DataValue pl_in) {
+
+    var bitstring mask := int2bit(pl_in.EncodingMask, 6);
+    log (mask);
+
+
+    if (mask[0] == '1'B and pl_in.ServerPicoSeconds == omit) {
+      pl_in.ServerPicoSeconds := 0;
+    }
+
+    if (mask[2] == '1'B and pl_in.SourcePicoSecond == omit) {
+      pl_in.SourcePicoSecond := 0;
+    }
+
+    log (pl_in);
+  }
+}
diff --git a/src/OpcUa_Templates_JSON_Reversible.ttcn b/src/OpcUa_Templates_JSON_Reversible.ttcn
new file mode 100644
index 0000000..8782a59
--- /dev/null
+++ b/src/OpcUa_Templates_JSON_Reversible.ttcn
@@ -0,0 +1,127 @@
+/////////////////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2017-2018  Ericsson AB
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+/////////////////////////////////////////////////////////////////////////////////////
+// Contributors:
+// Akos Makovics
+//
+//  File:         OpcUa_Templates_JSON_Reversible.ttcn
+//  Rev:          <RnXnn>
+//  Prodnr:       CNL113861
+/////////////////////////////////////////////////////////////////////////////////////
+
+
+module OpcUa_Templates_JSON_Reversible {
+
+  import from OpcUa_Types_JSON_Reversible all;
+
+  /////////////////////////////////////////////////////////////
+  //                      Templates                          //
+  //      Note: Not every type has a template, and           //
+  //       some types may have multiple templates.           //
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                   Complex Types                         //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+   //TODO: Add Templates
+   //NodeId with an UInt32 value
+  template NodeId tr_NodeId_UInt32 (
+    UInt32 Id,
+    template integer Namespace
+  ):= {
+    IdType := omit,
+    Id := {
+      UInt32NodeId := Id
+    },
+    Namespace := Namespace
+  }
+   //NodeId with a String value
+  template NodeId tr_NodeId_String (
+    String Id,
+    template integer Namespace
+  ):= {
+    IdType := 1,
+    Id := {
+      StringNodeId := Id
+    },
+    Namespace := Namespace
+  }
+   //NodeId with a GUID value
+  template NodeId tr_NodeId_GUID (
+    Guid Id,
+    template integer Namespace
+  ):= {
+    IdType := 2,
+    Id := {
+      GuidNodeId := Id
+    },
+    Namespace := Namespace
+  }
+   //NodeId with a ByteString value
+  template NodeId tr_NodeId_ByteString (
+    ByteString Id,
+    template integer Namespace
+  ):= {
+    IdType := 3,
+    Id := {
+      ByteStringNodeId := Id
+    },
+    Namespace := Namespace
+  }
+   //ExpandedNodeId with an UInt32 value
+  template ExpandedNodeId tr_ExpandedNodeId_UInt32 (
+    UInt32 Id,
+    template integer Namespace,
+    template integer ServerURI
+  ):= {
+    IdType := omit,
+    Id := {
+      UInt32NodeId := Id
+    },
+    Namespace := Namespace,
+    ServerURI := ServerURI
+  }
+   //ExpandedNodeId with a String value
+  template ExpandedNodeId tr_ExpandedNodeId_String (
+    String Id,
+    template integer Namespace,
+    template integer ServerURI
+  ):= {
+    IdType := 1,
+    Id := {
+      StringNodeId := Id
+    },
+    Namespace := Namespace,
+    ServerURI := ServerURI
+  }
+   //ExpandedNodeId with a GUID value
+  template ExpandedNodeId tr_ExpandedNodeId_GUID (
+    Guid Id,
+    template integer Namespace,
+    template integer ServerURI
+  ):= {
+    IdType := 2,
+    Id := {
+      GuidNodeId := Id
+    },
+    Namespace := Namespace,
+    ServerURI := ServerURI
+  }
+   //ExpandedNodeId with a ByteString value
+  template ExpandedNodeId tr_ExpandedNodeId_ByteString (
+    ByteString Id,
+    template integer Namespace,
+    template integer ServerURI
+  ):= {
+    IdType := 3,
+    Id := {
+      ByteStringNodeId := Id
+    },
+    Namespace := Namespace,
+    ServerURI := ServerURI
+  }
+} 
\ No newline at end of file
diff --git a/src/OpcUa_Types_JSON_Reversible.ttcn b/src/OpcUa_Types_JSON_Reversible.ttcn
new file mode 100644
index 0000000..3d2cc1c
--- /dev/null
+++ b/src/OpcUa_Types_JSON_Reversible.ttcn
@@ -0,0 +1,3473 @@
+/////////////////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2017  Ericsson AB
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+/////////////////////////////////////////////////////////////////////////////////////
+// Contributors:
+// Akos Makovics
+//
+//  File:         OpcUa_Types_JSON_Reversible.ttcn
+//  Rev:          R1A
+//  Prodnr:       CNL
+/////////////////////////////////////////////////////////////////////////////////////
+
+module OpcUa_Types_JSON_Reversible
+{
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                 Encoders and Decoders                   //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  //TODO: Add ecoders and decoders
+  external function enc_MessageTypes (in MessageTypes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_MessageTypes (in octetstring p_oct, out MessageTypes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                     Constant Values                     //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  const integer Null_Value := -2147483647;
+
+  const integer HelloHeaderMsgType := 4998472;
+  const integer AckHeaderMsgType := 4932417;
+  const integer ErrorHeaderMsgType := 5395013;
+  const integer ReverseHelloHeaderMsgType := 4540498;
+
+  const integer OpenSecureChannelMsgType := 5132367;
+  const integer CloseSecureChannelMsgType := 5196867;
+  const integer ServicesMsgType := 4674381;
+
+  const integer FindServiceRequestNodeId := 0; //No data in XML
+  const integer FindServiceResponseNodeId := 1; //No data in XML
+  const integer CloseSecureChannelRequestNodeId := 450;
+  const integer CloseSecureChannelResponseNodeId := 453;
+  const integer OpenSecureChannelRequestNodeId := 444;
+  const integer OpenSecureChannelResponseNodeId := 447;
+  const integer FindServersOnNetworkRequestNodeId := 12208;
+  const integer FindServersOnNetworkResponseNodeId := 12209;
+  const integer GetEndpointsRequestNodeId := 426;
+  const integer GetEndpointsResponseNodeId := 429;
+  const integer RegisterServerRequestNodeId := 435;
+  const integer RegisterServerResponseNodeId := 438;
+  const integer RegisterServer2RequestNodeId := 12211;
+  const integer RegisterServer2ResponseNodeId := 12212;
+  const integer CreateSessionRequestNodeId := 459;
+  const integer CreateSessionResponseNodeId := 462;
+  const integer ActivateSessionRequestNodeId := 465;
+  const integer ActivateSessionResponseNodeId := 468;
+  const integer CloseSessionRequestNodeId := 471;
+  const integer CloseSessionResponseNodeId := 474;
+  const integer CancelRequestRequestNodeId := 477;
+  const integer CancelRequestResponseNodeId := 480;
+  const integer AddNodesRequestNodeId := 486;
+  const integer AddNodesResponseNodeId := 489;
+  const integer AddReferencesRequestNodeId := 492;
+  const integer AddReferencesResponseNodeId := 495;
+  const integer DeleteNodesRequestNodeId := 488;
+  const integer DeleteNodesResponseNodeId := 501;
+  const integer DeleteReferencesRequestNodeId := 504;
+  const integer DeleteReferencesResponseNodeId := 507;
+  const integer BrowseRequestNodeId := 525;
+  const integer BrowseResponseNodeId := 528;
+  const integer BrowseNextRequestNodeId := 531;
+  const integer BrowseNextResponseNodeId := 534;
+  const integer TranslateBrowsePathsToNodeIdsRequestNodeId := 552;
+  const integer TranslateBrowsePathsToNodeIdsResponseNodeId := 555;
+  const integer RegisterNodesRequestNodeId := 558;
+  const integer RegisterNodesResponseNodeId := 561;
+  const integer UnregisterNodesRequestNodeId := 564;
+  const integer UnregisterNodesResponseNodeId := 567;
+  const integer QueryFirstRequestNodeId := 613;
+  const integer QueryFirstResponseNodeId := 616;
+  const integer QueryNextRequestNodeId := 619;
+  const integer QueryNextResponseNodeId := 622;
+  const integer ReadRequestNodeId := 629;
+  const integer ReadResponseNodeId := 632;
+  const integer HistoryReadRequestNodeId := 662;
+  const integer HistoryReadResponseNodeId := 665;
+  const integer WriteRequestNodeId := 671;
+  const integer WriteResponseNodeId := 675;
+  const integer HistoryUpdateRequestNodeId := 698;
+  const integer HistoryUpdateResponseNodeId := 701;
+  const integer CallRequestNodeId := 710;
+  const integer CallResponseNodeId := 713;
+  const integer CreateMonitoredItemsRequestNodeId := 749;
+  const integer CreateMonitoredItemsResponseNodeId := 752;
+  const integer ModifyMonitoredItemsRequestNodeId := 761;
+  const integer ModifyMonitoredItemsResponseNodeId := 764;
+  const integer SetMonitoringModeRequestNodeId := 767;
+  const integer SetMonitoringModeResponseNodeId := 770;
+  const integer SetTriggeringRequestNodeId := 773;
+  const integer SetTriggeringResponseNodeId := 776;
+  const integer DeleteMonitoredItemsRequestNodeId := 779;
+  const integer DeleteMonitoredItemsResponseNodeId := 782;
+  const integer CreateSubscriptionRequestNodeId := 785;
+  const integer CreateSubscriptionResponseNodeId := 789;
+  const integer ModifySubscriptionRequestNodeId := 791;
+  const integer ModifySubscriptionResponseNodeId := 794;
+  const integer SetPublishingModeRequestNodeId := 797;
+  const integer SetPublishingModeResponseNodeId := 800;
+  const integer PublishRequestNodeId := 824;
+  const integer PublishResponseNodeId := 827;
+  const integer RepublishRequestNodeId := 830;
+  const integer RepublishResponseNodeId := 833;
+  const integer TransferSubscriptionsRequestNodeId := 839;
+  const integer TransferSubscriptionsResponseNodeId := 842;
+  const integer DeleteSubscriptionsRequestNodeId := 845;
+  const integer DeleteSubscriptionsResponseNodeId := 848;
+
+  const integer FinalChunk := 70;
+  const integer IntermediateChunk := 67;
+  const integer ErrorChunk := 65;
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                     Enumerations                        //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type enumerated MessageSecurityMode {
+    INVALID_0,
+    NONE_1,
+    SIGN_2,
+    SIGNANDENCRYPT_3
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated SecurityTokenRequestType {
+    ISSUE_0,
+    RENEW_1
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated NodeClass
+  {
+    UNSPECIFIED_0(0),
+    OBJECT_1(1),
+    VARIABLE_2(2),
+    METHOD_4(4),
+    OBJECT_TYPE_8(8),
+    VARIABLE_TYPE_16(16),
+    REFERENCE_TYPE_32(32),
+    DATA_TYPE_64(64),
+    VIEW_128(128)
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated StructureType {
+    STRUCTURE_0,
+    STRUCTURE_WITH_OPTIONAL_FIELDS_1,
+    UNION_2
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated ApplicationType {
+    SERVER_0,
+    CLIENT_1,
+    CLIENTANDSERVER_2,
+    DISCOVERYSERVER_3
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated DataChangeTrigger {
+    STATUS_0,
+    STATUS_VALUE_1,
+    STATUS_VALUE_TIMESTAMP_2
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated MonitoringMode {
+    DISABLED_0,
+    SAMPLING_1,
+    REPORTING_2
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated BrowseDirection {
+    FORWARD_0,
+    INVERSE_1,
+    BOTH_2
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated TimestampsToReturn {
+    SOURCE_0,
+    SERVER_1,
+    BOTH_2,
+    NEITHER_3
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated UserIdentityTokenType {
+    ANONYMOUS_0,
+    USERNAME_1,
+    CERTIFICATE_2,
+    ISSUEDTOKEN_3
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated PerformUpdateType {
+    INSERT_1(1),
+    REPLACE_2(2),
+    UPDATE_3(3)
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated PerformUpdateTypeExtended {
+    INSERT_1(1),
+    REPLACE_2(2),
+    UPDATE_3(3),
+    REMOVE_4(4)
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated IdType
+  {
+    NUMERIC_0,
+    STRING_1,
+    GUID_2,
+    OPAQUE_3
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated FilterOperator {
+    Equals_0,
+    IsNull_1,
+    GreaterThan_2,
+    LessThan_3,
+    GreaterThanOrEqual_4,
+    LessThanOrEqual_5,
+    Like_6,
+    Not_7,
+    Between_8,
+    InList_9,
+    And_10,
+    Or_11,
+    Cast_12,
+    InView_13,
+    OfType_14,
+    RelatedTo_15,
+    BitwiseAnd_16,
+    BitwiseOr_17
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated OpenFileMode
+  {
+    READ_1(1),
+    WRITE_2(2),
+    ERASE_EXISTING_4(4),
+    APPEND_8(8)
+  } with {
+    variant "JSON: as number"
+  }
+
+  type enumerated TrustListMasks
+  {
+    none_0(0),
+    trustedCertificates_1(1),
+    trustedCrls_2(2),
+    issuerCertificates_4(4),
+    issuerCrls_8(8),
+    all_15(15)
+  } with {
+    variant "JSON: as number"
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                      Base Types                         //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  //Encoded as the JSON literal ‘true’ or ‘false’.
+  type boolean Boolean;
+
+  //An integer value between -128 and 127 inclusive.
+  type integer SByte with { variant "FIELDLENGTH(8), COMP(signbit), FIELDORDER(lsb)" };
+
+  //An integer value between 0 and 255 inclusive.
+  type integer Byte with { variant "FIELDLENGTH(8), COMP(nosign), FIELDORDER(lsb)" };
+
+  //An integer value between -32 768 and 32 767 inclusive.
+  type integer Int16 with { variant "FIELDLENGTH(16), COMP(signbit), FIELDORDER(lsb)" };
+
+  //An integer value between 0 and 65 535 inclusive.
+  type integer UInt16 with { variant "FIELDLENGTH(16), COMP(nosign), FIELDORDER(lsb)" };
+
+  //An integer value between 0 and 16 777 215
+  type integer UInt24 with { variant "FIELDLENGTH(24), COMP(nosign), FIELDORDER(lsb)" }
+
+  //An integer value between -2 147 483 648 and 2 147 483 647 inclusive.
+  type integer Int32 with { variant "FIELDLENGTH(32), COMP(signbit), FIELDORDER(lsb)" };
+
+  //An integer value between 0 and 4 294 967 295 inclusive.
+  type integer UInt32 with { variant "FIELDLENGTH(32), COMP(nosign), FIELDORDER(lsb)" };
+
+  //An integer value between -9 223 372 036 854 775 808 and 9 223 372 036 854 775 807 inclusive.
+  type charstring Int64 with { variant "FIELDLENGTH(64), COMP(signbit), FIELDORDER(lsb)" };
+
+  //An integer value between 0 and 18 446 744 073 709 551 615 inclusive.
+  type charstring UInt64 with { variant "FIELDLENGTH(64), COMP(nosign), FIELDORDER(lsb)" };
+
+  //An IEEE single precision (32 bit) floating point value.
+  type float Float with { variant "FORMAT(IEEE754 float), FIELDLENGTH(32), FIELDORDER(lsb)"};
+
+  //An IEEE double precision (64 bit) floating point value.
+  type float Double with { variant "FORMAT(IEEE754 double), FIELDLENGTH(64), FIELDORDER(lsb)"};
+
+  //Defines an interval of time in milliseconds
+  type Double Duration;
+
+  //Number of 100 nanosecond intervals since January 1, 1601
+  type charstring DateTime with { variant "FIELDLENGTH(64), COMP(signbit), BYTEORDER(first)"};
+
+  //Define Coordinated Universal Time (UTC) values.
+  type DateTime UtcTime;
+
+  //Represents the time in seconds since the year 2000. It is used as version number based on the last change time.
+  type UInt32 VersionTime;
+
+  //Represents the value of a counter
+  type UInt32 Counter;
+
+  //Identifies an element of an array
+  type UInt32 Index;
+
+  //Used as an identifier, such as a handle. All values, except for 0, are valid.
+  type UInt32 IntegerId;
+
+  //Representing an image.
+  type octetstring Image;
+
+  //Representing an image in BMP format.
+  type octetstring ImageBMP;
+
+  //Representing an image in GIF format.
+  type octetstring ImageGIF;
+
+  //Representing an image in JPG format.
+  type octetstring ImageJPG;
+
+  //Representing an image in PNG format.
+  type octetstring ImagePNG;
+
+  //Representing audio data. It can be any number of audio formats.
+  type ByteString AudioData;
+
+  //A string that is composed of a language component and a country/region component
+  type String LocaleId;
+
+  //Used to pause a Browse or QueryFirst operation
+  type ByteString ContinuationPoint;
+
+  //Used for indexing a range within an array
+  type String NumericRange;
+
+  //An opaque identifier that is used to identify requests associated with a particular Session.
+  type NodeId SessionAuthenticationToken;
+
+  //Sequence of UTF-8 characters without a null terminator and preceded by the length in bytes.
+  type charstring String;
+
+  //A 16-byte value that can be used as a globally unique identifier.
+  type charstring Guid;
+
+  //Sequence of bytes preceded by its length in bytes
+  type charstring ByteString
+
+  //An XML element, as an XML fragment serialized as UTF-8 string
+  type charstring XmlElement;
+
+  //
+  type integer StatusCode;
+
+  type Int32 DataType;
+  type Variant BaseDataType;
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                   Complex Types                         //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  //An identifier for a node in the address space of an OPC UA Server.
+  type record NodeId {
+    Byte IdType optional,
+    NodeIdType Id,
+    integer Namespace optional
+  } with {
+    variant (Id) "chosen (StringNodeId, IdType = 1;
+                          GuidNodeId, IdType = 2;
+                          ByteStringNodeId, IdType = 3;
+                          UInt32NodeId, otherwise;)"
+
+    variant(IdType) "JSON : default (0)"
+  }
+
+  //Helper type, contains the possible body types for NodeId
+  type union NodeIdType {
+    UInt32 UInt32NodeId,
+    String StringNodeId,
+    Guid GuidNodeId,
+    ByteString ByteStringNodeId
+  } with {
+    variant "JSON: as value"
+  }
+
+  type record ExpandedNodeId {
+    Byte IdType optional,
+    NodeIdType Id,
+    integer Namespace optional,
+    integer ServerURI optional
+  } with {
+    variant (Id) "chosen (StringNodeId, IdType = 1;
+                          GuidNodeId, IdType = 2;
+                          ByteStringNodeId, IdType = 3;
+                          UInt32NodeId, otherwise;)"
+
+    variant(IdType) "JSON : default (0)"
+  }
+
+  type record DiagnosticInfo {
+    Int32 SymbolicId,
+    Int32 NamespaceUri,
+    Int32 Locale,
+    Int32 LocalizedText,
+    String AdditionalInfo,
+    StatusCode InnerStatusCode,
+    DiagnosticInfo InnerDiagnosticInfo optional
+  }
+
+  //A name qualified by a namespace.
+  type record QualifiedName {
+    UInt16 namespaceIndex,
+    String name
+  }
+
+  //Human readable text with an optional locale identifier.
+  type record LocalizedText {
+    String locale,
+    String text
+  }
+
+  //A structure that contains an application specific data type that may not be recognized by the receiver
+  type record ExtensionObject {
+    NodeId typeId,
+    Byte encoding optional,
+    ExtensionObjectBody body optional
+  } with {
+    variant (body)"chosen( structure, encoding = 0;
+                           byteString,  encoding = 1;
+                           xmlElement, encoding = 2)";
+  }
+
+  type union ExtensionObjectBody {
+    octetstring structure,
+    String byteString,
+    String xmlElement
+  }
+
+  type record Variant {
+    integer Type,
+    VariantBody Body optional,
+    ListOfInteger Dimensions optional
+  }
+
+  type union VariantBody {
+    Boolean bool,
+    SByte sbyte,
+    Byte byte,
+    Int16 int16,
+    UInt16 uint16,
+    Int32 int32,
+    UInt32 uint32,
+    Int64 int64,
+    UInt64 uint64,
+    Float Float,
+    Double double,
+    String string,
+    DateTime datetime,
+    Guid guid,
+    ByteString bytestring,
+    XmlElement xmlelement,
+    NodeId nodeid,
+    ExpandedNodeId expandednodeid,
+    StatusCode statuscode,
+    QualifiedName qualifiedname,
+    LocalizedText localizedtext,
+    ExtensionObject extensionobject,
+    DataValue datavalue,
+    ListOfVariant listofvariant,
+    DiagnosticInfo diagnosticinfo,
+    ListOfBoolean listOfBool,
+    ListOfSByte listOfSbyte,
+    ListOfByte listOfByte,
+    ListOfInt16 listOfInt16,
+    ListOfUInt16 listOfUint16,
+    ListOfInt32 listOfInt32,
+    ListOfUInt32 listOfUint32,
+    ListOfInt64 listOfInt64,
+    ListOfUInt64 listOfUint64,
+    ListOfFloat listOfFloatValue,
+    ListOfDouble listOfDouble,
+    ListOfString listOfString,
+    ListOfDateTime listOfDatetime,
+    ListOfGuid listOfGuid,
+    ListOfByteString listOfBytestring,
+    ListOfXmlElement listOfXmlelement,
+    ListOfNodeId listOfNodeid,
+    ListOfExpandedNodeId listOfExpandednodeid,
+    ListOfStatusCode listOfStatuscode,
+    ListOfQualifiedName listOfQualifiedname,
+    ListOfLocalizedText listOfLocalizedtext,
+    ListOfExtensionObject listOfExtensionobject,
+    ListOfDataValue listOfDatavalue,
+    ListOfVariant listOfListofvariant,
+    ListOfDiagnosticInfo listOfDiagnosticinfo
+  }
+
+  type record DataValue {
+    integer EncodingMask,
+    Variant Value optional,
+    StatusCode Status optional,
+    DateTime SourceTimeStamp optional,
+    UInt16 SourcePicoSecond optional,
+    DateTime ServerTimestamp optional,
+    UInt16 ServerPicoSeconds optional
+  }
+
+  type record Decimal {
+    integer Scale,
+    String Value
+  }
+
+  //Represent a human-readable representation of an Enumeration.
+  type record EnumValueType {
+    Int64 Value,
+    LocalizedText displayName,
+    LocalizedText description
+  }
+
+  //Base DataType for all DataTypes representing a bit mask.
+  type record OptionSet {
+    ByteString Value,
+    ByteString validBits
+  }
+
+  //Provides the meta data for a custom Structure DataType.
+  type record StructureDefinition {
+    NodeId defaultEncodingId,
+    NodeId baseDataType,
+    StructureType structureType,
+    ListOfStructureField fields
+  }
+
+  //Provides the metadata for a custom Enumeration or OptionSet DataType.
+  type record EnumDefinition {
+    ListOfEnumField fields
+  }
+
+  //Provides the metadata for a field of a custom Enumeration or OptionSet DataType.
+  type record EnumField {
+    String name
+  }
+
+  //Provides the metadata for a field of a custom Structure DataType.
+  type record StructureField {
+    String name,
+    LocalizedText description,
+    NodeId dataType,
+    Int32 valueRank,
+    Boolean isOptional
+  }
+
+  //Implementation of the Extension Object for the Extensible Parameter types
+  type record ExtensibleParameter {
+    NodeId parameterTypeId,
+    ExtensibleParameterBody extensibleParameterBody optional
+  }
+
+  //Possible extension types
+  type union ExtensibleParameterBody {
+    ElementOperand elementOperand,
+    LiteralOperand literalOperand,
+    AttributeOperand attributeOperand,
+    SimpleAttributeOperand simpleAttributeOperand,
+    DataChangeFilter dataChangeFilter,
+    EventFilter eventFilter,
+    AggregateFilter aggregateFilter,
+    EventFilterResult eventFilterResult,
+    AggregateFilterResult aggregateFilterResult,
+    ObjectAttributes objectAttributes,
+    VariableAttributes variableAttributes,
+    MethodAttributes methodAttributes,
+    ObjectTypeAttributes objectTypeAttributes,
+    VariableTypeAttributes variableTypeAttributes,
+    ReferenceTypeAttributes referenceTypeAttributes,
+    DataTypeAttributes dataTypeAttributes,
+    ViewAttributes viewAttributes,
+    GenericAttributes genericAttributes,
+    UserNameIdentityToken userNameIdentityToken,
+    X509IdentityToken x509IdentityToken,
+    IssuedIdentityToken issuedIdentityToken,
+    AnonymousIdentityToken anonymousIdentityToken,
+    MdnsDiscoveryConfiguration mdnsDiscoveryConfiguration,
+    ReadEventDetails readEventDetails,
+    ReadRawModifiedDetails readRawModifiedDetails,
+    ReadProcessedDetails readProcessedDetails,
+    ReadAtTimeDetails readAtTimeDetails,
+    ListOfDataValue dataValues,
+    UpdateDataDetails updateDataDetails,
+    UpdateStructureDataDetails updateStructureDataDetails,
+    UpdateEventDetails updateEventDetails,
+    DeleteRawModifiedDetails deleteRawModifiedDetails,
+    DeleteAtTimeDetails deleteAtTimeDetails,
+    DeleteEventDetails deleteEventDetails,
+    DataChangeNotification dataChangeNotification,
+    EventNotificationList eventNotificationList,
+    StatusChangeNotification statusChangeNotification
+  } with {
+    variant "";
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                 Lists and Arrays                        //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  //Arrays of types. Used in lists, and in templates for lists
+  type record of Boolean ListOfBoolean;
+  type record of integer ListOfInteger;
+  type record of SByte ListOfSByte;
+  type record of Byte ListOfByte;
+  type record of Int16 ListOfInt16;
+  type record of UInt16 ListOfUInt16;
+  type record of Int32 ListOfInt32;
+  type record of UInt32 ListOfUInt32;
+  type record of Int64 ListOfInt64;
+  type record of UInt64 ListOfUInt64;
+  type record of Float ListOfFloat;
+  type record of Double ListOfDouble;
+  type record of DateTime ListOfDateTime;
+  type record of UtcTime ListOfUtcTime;
+  type record of Counter ListOfCounter;
+  type record of IntegerId ListOfIntegerId;
+  type record of LocaleId ListOfLocaleId;
+  type record of ContinuationPoint ListOfContinuationPoint;
+  type record of String ListOfString;
+  type record of Guid ListOfGuid;
+  type record of ByteString ListOfByteString;
+  type record of XmlElement ListOfXmlElement;
+  type record of NodeId ListOfNodeId;
+  type record of ExpandedNodeId ListOfExpandedNodeId;
+  type record of StatusCode ListOfStatusCode;
+  type record of DiagnosticInfo ListOfDiagnosticInfo;
+  type record of QualifiedName ListOfQualifiedName;
+  type record of LocalizedText ListOfLocalizedText;
+  type record of ExtensionObject ListOfExtensionObject;
+  type record of Variant ListOfVariant;
+  type record of DataValue ListOfDataValue;
+  type record of Decimal ListOfDecimal;
+  type record of EnumValueType ListOfEnumValueType;
+  type record of EnumField ListOfEnumField;
+  type record of StructureField ListOfStructureField;
+  type record of ExtensibleParameter ListOfExtensibleParameter;
+  type record of ApplicationDescription ListOfApplicationDescription;
+  type record of BrowseResult ListOfBrowseResult;
+  type record of ContentFilterElement ListOfContentFilterElement;
+  type record of ContentFilterElementResult ListOfContentFilterElementResult;
+  type record of SimpleAttributeOperand ListOfSimpleAttributeOperand;
+  type record of EndpointDescription ListOfEndpointDescription;
+  type record of MonitoringParameters ListOfMonitoringParameters;
+  type record of GenericAttributeValue ListOfGenericAttributeValue;
+  type record of MonitoredItemNotification ListOfMonitoredItemNotification;
+  type record of EventFieldList ListOfEventFieldList;
+  type record of QueryDataSet ListOfQueryDataSet;
+  type record of ReadValueId ListOfReadValueId;
+  type record of ReferenceDescription ListOfReferenceDescription;
+  type record of RelativePathElement ListOfRelativePathElement;
+  type record of ApplicationInstanceCertificate ListOfApplicationInstanceCertificate;
+  type record of ChannelSecurityToken ListOfChannelSecurityToken;
+  type record of UserTokenPolicy ListOfUserTokenPolicy;
+  type record of ServerOnNetwork ListOfServerOnNetwork;
+  type record of AddNodesItem ListOfAddNodesItem;
+  type record of AddNodesResult ListOfAddNodesResult;
+  type record of AddReferencesItem ListOfAddReferencesItem;
+  type record of DeleteNodesItem ListOfDeleteNodesItem;
+  type record of DeleteReferencesItem ListOfDeleteReferencesItem;
+  type record of SignedSoftwareCertificate ListOfSignedSoftwareCertificate;
+  type record of BrowseDescription ListOfBrowseDescription;
+  type record of BrowsePath ListOfBrowsePath;
+  type record of BrowsePathResult ListOfBrowsePathResult;
+  type record of BrowsePathTarget ListOfBrowsePathTarget;
+  type record of NodeTypeDescription ListOfNodeTypeDescription;
+  type record of QueryDataDescription ListOfQueryDataDescription;
+  type record of ParsingResult ListOfParsingResult;
+  type record of HistoryReadValueId ListOfHistoryReadValueId;
+  type record of HistoryReadResult ListOfHistoryReadResult;
+  type record of WriteValue ListOfWriteValue;
+  type record of HistoryUpdateResult ListOfHistoryUpdateResult;
+  type record of CallMethodRequest ListOfCallMethodRequest;
+  type record of CallMethodResult ListOfCallMethodResult;
+  type record of MonitoredItemCreateRequest ListOfMonitoredItemCreateRequest;
+  type record of MonitoredItemCreateResult ListOfMonitoredItemCreateResult;
+  type record of MonitoredItemModifyRequest ListOfMonitoredItemModifyRequest;
+  type record of MonitoredItemModifyResult ListOfMonitoredItemModifyResult;
+  type record of SubscriptionAcknowledgement ListOfSubscriptionAcknowledgement;
+  type record of TransferResult ListOfTransferResult;
+  type record of BaseDataType ListOfBaseDataType;
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                    Common Parameters                    //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  //Information that describes an application.
+  type record ApplicationDescription {
+    String applicationUri,
+    String productUri,
+    LocalizedText applicationName,
+    ApplicationType applicationType,
+    String gatewayServerUri,
+    String discoveryProfileUri,
+    ListOfString discoveryUrls
+  }
+
+  //Information that identified an application instance
+  type record ApplicationInstanceSubjectIdentifier {
+    String name
+  }
+
+  //Information that identified the issuer of an application instance
+  type record ApplicationInstanceIssuerIdentifier {
+    String productName ,
+    String organisation
+  }
+
+  type record BrowseResult {
+    StatusCode statusCode,
+    ContinuationPoint continuationPoint,
+    ListOfReferenceDescription References
+  }
+
+  type record ContentFilter {
+    ListOfContentFilterElement elements
+  }
+
+  type record ContentFilterElement {
+    FilterOperator filterOperator,
+    ListOfExtensibleParameter filterOperands
+  }
+
+  type record ContentFilterResult {
+    ListOfContentFilterElementResult elementResults,
+    ListOfDiagnosticInfo elementDiagnosticInfos
+  }
+
+  type record ContentFilterElementResult {
+    StatusCode statusCode,
+    ListOfStatusCode operandStatusCodes,
+    ListOfDiagnosticInfo operandDiagnosticInfos
+  }
+
+  type record ElementOperand {
+    UInt32 index
+  }
+
+  type record LiteralOperand {
+    BaseDataType Value
+  }
+
+  type record AttributeOperand {
+    NodeId nodeId,
+    String alias,
+    RelativePath browsePath,
+    IntegerId attributeId,
+    NumericRange indexRange
+  }
+
+  type record SimpleAttributeOperand {
+    NodeId typeId,
+    ListOfQualifiedName browsePath,
+    IntegerId attributeId,
+    NumericRange indexRange
+  }
+
+  type record MdnsDiscoveryConfiguration {
+    String mdnsServerName,
+    ListOfString serverCapabilities
+  }
+
+  type record EndpointDescription {
+    String endpointUrl,
+    ApplicationDescription server,
+    ByteString  serverCertificate,
+    MessageSecurityMode securityMode,
+    String securityPolicyUri,
+    ListOfUserTokenPolicy userIdentityTokens,
+    String transportProfileUri,
+    Byte securityLevel
+  }
+
+  type record MonitoringParameters {
+    IntegerId clientHandle,
+    Duration samplingInterval,
+    ExtensibleParameter filter,
+    Counter queueSize,
+    Boolean discardOldest
+  }
+
+  type record DataChangeFilter {
+    DataChangeTrigger Trigger,
+    UInt32 deadbandType,
+    Double deadbandValue
+  }
+
+  type record EventFilter {
+    ListOfSimpleAttributeOperand selectClauses,
+    ContentFilter whereClause
+  }
+
+  type record EventFilterResult {
+    ListOfStatusCode selectClauseResults,
+    ListOfDiagnosticInfo selectClauseDiagnosticInfos,
+    ContentFilterResult whereClauseResult
+  }
+
+  type record AggregateFilter {
+    UtcTime startTime,
+    NodeId aggregateType,
+    Duration processingInterval,
+    AggregateConfiguration aggregateConfiguration,
+    Boolean useServerCapabilitiesDefaults,
+    Boolean treatUncertainAsBad,
+    Byte percentDataBad,
+    Byte percentDataGood,
+    Boolean useSlopedExtrapolation
+  }
+
+  type record AggregateConfiguration {
+    Boolean TreatUncertainAsBad,
+    Boolean useSeverCapabilitiesDefaults,
+    Byte PercentDataBad,
+    Byte PercentDataGood,
+    Boolean UseSlopedExtrapolation
+  }
+
+  type record AggregateFilterResult {
+    UtcTime revisedStartTime,
+    Duration revisedProcessingInterval
+  }
+
+  type record ObjectAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    Byte eventNotifier optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record VariableAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    DataType Value optional,
+    NodeId dataType optional,
+    Int32 valueRank optional,
+    ListOfUInt32 arrayDimensions optional,
+    Byte accessLevel optional,
+    Byte userAccessLevel optional,
+    Duration minimumSamplingInterval optional,
+    Boolean historizing optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record MethodAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    Boolean executable optional,
+    Boolean userExecutable optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record ObjectTypeAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    Boolean isAbstract optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record VariableTypeAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    DataType Value optional,
+    NodeId dataType optional,
+    Int32 valueRank optional,
+    ListOfUInt32 arrayDimensions optional,
+    Boolean isAbstract optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record ReferenceTypeAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    Boolean isAbstract optional,
+    Boolean symmetric optional,
+    LocalizedText inverseName optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record DataTypeAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    Boolean isAbstract optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record ViewAttributes {
+    integer EncodingMask,
+    LocalizedText displayName optional,
+    LocalizedText description optional,
+    Boolean containsNoLoops optional,
+    Byte eventNotifier optional,
+    UInt32 writeMask optional,
+    UInt32 userWriteMask optional
+  }
+
+  type record GenericAttributes {
+    ListOfGenericAttributeValue attributeValues
+  }
+
+  type record GenericAttributeValue {
+    IntegerId attributeId,
+    BaseDataType Value
+  }
+
+  type record DataChangeNotification {
+    ListOfMonitoredItemNotification monitoredItems,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record MonitoredItemNotification {
+    IntegerId clientHandle,
+    DataValue Value
+  }
+
+  type record EventNotificationList {
+    ListOfEventFieldList events
+  }
+
+  type record EventFieldList {
+    IntegerId clientHandle,
+    ListOfBaseDataType eventFields
+  }
+
+  type record StatusChangeNotification {
+    StatusCode status,
+    DiagnosticInfo diagnosticInfo
+  }
+
+  type record NotificationMessage {
+    Counter sequenceNumber,
+    UtcTime publishTime,
+    ListOfExtensibleParameter notificationData
+  }
+
+  type record QueryDataSet {
+    ExpandedNodeId nodeId,
+    ExpandedNodeId typeDefinitionNode,
+    ListOfBaseDataType values
+  }
+
+  type record ReadValueId {
+    NodeId nodeId,
+    IntegerId attributeId,
+    NumericRange indexRange,
+    QualifiedName dataEncoding
+  }
+
+  type record ReferenceDescription {
+    NodeId referenceTypeId,
+    Boolean isForward,
+    ExpandedNodeId nodeId,
+    QualifiedName browseName,
+    LocalizedText displayName,
+    NodeClass nodeClass,
+    ExpandedNodeId typeDefinition
+  }
+
+  type record RelativePath {
+    ListOfRelativePathElement elements
+  }
+
+  type record RelativePathElement {
+    NodeId referenceTypeId,
+    Boolean isInverse,
+    Boolean includeSubtypes,
+    QualifiedName targetName
+  }
+
+  type record RegisteredServer {
+    String serverUri,
+    String productUri,
+    ListOfLocalizedText serverNames,
+    ApplicationType serverType,
+    String gatewayServerUri,
+    ListOfString discoveryUrls,
+    String semaphoreFilePath,
+    Boolean isOnline
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //         Structures for Security (Incomplete)            //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record ApplicationInstanceCertificate {
+    String version,
+    ByteString serialNumber,
+    String signatureAlgorithm,
+    ByteString Signature,
+    ApplicationInstanceIssuerIdentifier issuer,
+    UtcTime validFrom,
+    UtcTime validTo,
+    ApplicationInstanceSubjectIdentifier subject,
+    String applicationUri,
+    ListOfString hostnames,
+    ByteString publicKey,
+    ListOfString keyUsage
+  }
+
+  type record ChannelSecurityToken {
+    UInt32 channelId,
+    UInt32 tokenId,
+    UtcTime createdAt,
+    UInt32 revisedLifetime
+  }
+
+  type record EncryptedSecret {
+    NodeId TypeId,
+    Byte EncodingMask,
+    UInt32 Length,
+    String SecurityPolicyUri,
+    ByteString EncryptingCertificate,
+    DateTime SigningTime,
+    UInt16 PolicyHeaderLength,
+    ByteString SigningKey,
+    ByteString EncryptingKey,
+    ByteString InitializationVector,
+    ByteString Nonce,
+    Byte PolicyHeaderPadding optional,
+    UInt16 PolicyHeaderPaddingSize,
+    ByteString Secret,
+    Byte PayloadPadding optional,
+    UInt16 PayloadPaddingSize,
+    Byte Signature optional
+  }
+
+  type record RsaEncryptedSecret {
+    NodeId TypeId,
+    Byte EncodingMask,
+    UInt32 Length,
+    String SecurityPolicyUri,
+    ByteString EncryptingCertificate,
+    DateTime SigningTime,
+    UInt16 PolicyHeaderLength,
+    ByteString SigningKey,
+    ByteString EncryptingKey,
+    ByteString InitializationVector,
+    ByteString Nonce,
+    Byte PolicyHeaderPadding optional,
+    UInt16 PolicyHeaderPaddingSize,
+    ByteString Secret,
+    Byte PayloadPadding optional,
+    UInt16 PayloadPaddingSize,
+    Byte Signature optional
+  }
+
+  type record AnonymousIdentityToken {
+    String policyId
+  }
+
+  type record UserNameIdentityToken {
+    String policyId,
+    String userName,
+    ByteString password,
+    String encryptionAlgorithm
+  }
+
+  type record X509IdentityToken {
+    String policyId,
+    ByteString certificateData
+  }
+
+  type record IssuedIdentityToken {
+    String policyId,
+    ByteString tokenData,
+    String encryptionAlgorithm
+  }
+
+  type record UserTokenPolicy {
+    String policyId,
+    UserIdentityTokenType tokenType,
+    String issuedTokenType,
+    String issuerEndpointUrl,
+    String securityPolicyUri
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                 Structures for  Services                //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record ViewDescription {
+    NodeId viewId,
+    UtcTime timestamp,
+    UInt32 viewVersion
+  }
+
+  type record TrustListDataType {
+    TrustListMasks specifiedLists,
+    ListOfByteString trustedCertificates,
+    ListOfByteString trustedCrls,
+    ListOfByteString issuerCertificates,
+    ListOfByteString issuerCrls
+  }
+
+  type record ServerOnNetwork {
+    UInt32 recordId,
+    String serverName,
+    String discoveryUrl,
+    ListOfString serverCapabilities
+  }
+
+  type record AddNodesItem {
+    ExpandedNodeId parentNodeId,
+    NodeId referenceTypeId,
+    QualifiedName browseName,
+    NodeClass nodeClass,
+    ExtensibleParameter nodeAttributes,
+    ExpandedNodeId typeDefinition
+  }
+
+  type record AddNodesResult {
+    StatusCode statusCode,
+    NodeId addedNodeId,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record AddReferencesItem {
+    NodeId sourceNodeId,
+    NodeId referenceTypeId,
+    Boolean isForward,
+    String targetServerUri,
+    ExpandedNodeId targetNodeId,
+    NodeClass targetNodeClass
+  }
+
+  type record DeleteNodesItem {
+    NodeId nodeId,
+    Boolean deleteTargetReferences
+  }
+
+  type record DeleteReferencesItem {
+    NodeId sourceNodeId,
+    NodeId referenceTypeId,
+    Boolean isForward,
+    ExpandedNodeId targetNodeId,
+    Boolean deleteBidirectional
+  }
+
+    type record BrowseDescription {
+    NodeId nodeId,
+    BrowseDirection browseDirection,
+    NodeId referenceTypeId,
+    Boolean includeSubtypes,
+    UInt32 nodeClassMask,
+    UInt32 resultMask
+  }
+
+  type record SignatureData {
+    String algorithm,
+    ByteString Signature
+  }
+
+  type record SignedSoftwareCertificate {
+    ByteString certificateData,
+    ByteString Signature
+  }
+
+  type record BrowsePath {
+    NodeId startingNode,
+    RelativePath relativePath
+  }
+
+  type record BrowsePathResult {
+    StatusCode statusCode,
+    ListOfBrowsePathTarget targets
+  }
+
+  type record BrowsePathTarget {
+    ExpandedNodeId targetId,
+    Index remainingPathIndex
+  }
+
+  type record NodeTypeDescription {
+    ExpandedNodeId typeDefinitionNode,
+    Boolean includeSubtypes,
+    ListOfQueryDataDescription dataToReturn
+  }
+
+  type record QueryDataDescription {
+    RelativePath relativePath,
+    IntegerId attributeId,
+    NumericRange indexRange
+  }
+
+  type record ParsingResult {
+    StatusCode statusCode,
+    ListOfStatusCode dataStatusCodes,
+    ListOfDiagnosticInfo dataDiagnosticInfos
+  }
+
+  type record ReadEventDetails {
+    Counter numValuesPerNode,
+    UtcTime startTime,
+    UtcTime endTime,
+    EventFilter Filter
+  }
+
+  type record ReadRawModifiedDetails {
+    Boolean isReadModified ,
+    UtcTime startTime,
+    UtcTime endTime,
+    Counter numValuesPerNode,
+    Boolean returnBounds
+  }
+
+  type record ReadProcessedDetails {
+    UtcTime startTime,
+    UtcTime endTime,
+    Duration ProcessingInterval,
+    ListOfNodeId aggregateType,
+    AggregateConfiguration aggregateConfiguration
+  }
+
+  type record ReadAtTimeDetails {
+    ListOfUtcTime reqTimes,
+    Boolean useSimpleBounds
+  }
+
+  type record HistoryReadValueId {
+    NodeId nodeId,
+    NumericRange indexRange,
+    QualifiedName dataEncoding,
+    ByteString continuationPoint
+  }
+
+  type record HistoryReadResult {
+    StatusCode statusCode,
+    ByteString continuationPoint,
+    ExtensibleParameter historyData
+  }
+
+  type record WriteValue {
+    NodeId nodeId,
+    IntegerId attributeId,
+    NumericRange indexRange,
+    DataValue datavalue
+  }
+
+  type record UpdateDataDetails {
+    NodeId nodeId,
+    PerformUpdateType performInsertReplace,
+    ListOfDataValue updateValues
+  }
+
+  type record UpdateStructureDataDetails {
+    NodeId nodeId,
+    PerformUpdateTypeExtended performInsertReplace,
+    ListOfDataValue updateValues
+  }
+
+  type record UpdateEventDetails {
+    NodeId nodeId,
+    PerformUpdateType performInsertReplace,
+    EventFilter filter,
+    ListOfDataValue updateValues
+  }
+
+  type record DeleteRawModifiedDetails {
+    NodeId nodeId,
+    Boolean isDeleteModified,
+    UtcTime startTime,
+    UtcTime endTime
+  }
+
+  type record DeleteAtTimeDetails {
+    NodeId nodeId,
+    ListOfUtcTime reqTimes
+  }
+
+  type record DeleteEventDetails {
+    NodeId nodeId,
+    ListOfByteString eventId
+  }
+
+  type record HistoryUpdateResult {
+    StatusCode statusCode,
+    ListOfStatusCode operationResults,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record CallMethodRequest {
+    NodeId objectId,
+    NodeId methodId,
+    ListOfVariant inputArguments
+  }
+
+  type record CallMethodResult {
+    StatusCode statusCode,
+    ListOfStatusCode inputArgumentResults,
+    ListOfDiagnosticInfo inputArgumentDiagnosticInfos,
+    ListOfVariant outputArguments
+  }
+
+  type record MonitoredItemCreateRequest {
+    ReadValueId itemToMonitor,
+    MonitoringMode monitoringMode,
+    MonitoringParameters requestedParameters
+  }
+
+  type record MonitoredItemCreateResult {
+    StatusCode statusCode,
+    IntegerId monitoredItemId,
+    Duration revisedSamplingInterval,
+    Counter revisedQueueSize,
+    ExtensibleParameter filterResult
+  }
+
+  type record MonitoredItemModifyRequest {
+    IntegerId monitoredItemId,
+    MonitoringParameters requestedParameters
+  }
+
+  type record MonitoredItemModifyResult {
+    StatusCode statusCode,
+    Duration revisedSamplingInterval,
+    Counter revisedQueueSize,
+    ExtensibleParameter filterResult
+  }
+
+  type record SubscriptionAcknowledgement {
+    IntegerId subscriptionId,
+    Counter sequenceNumber
+  }
+
+  type record TransferResult {
+    StatusCode statusCode,
+    ListOfCounter availableSequenceNumbers
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                         Headers                         //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+
+  type record MessageHeader {
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize
+  }
+
+  type union SecurityHeader {
+    AsymmetricSecurityHeader asymmetricSecurityHeader,
+    SymmetricSecurityHeader symmetricSecurityHeader
+  }
+
+  type record SequenceHeader {
+    UInt32 SequenceNumber,
+    UInt32 RequestId
+  }
+
+  type record AsymmetricSecurityHeader {
+    Int32 SecurityPolicyUriLength,
+    ListOfByte SecurityPolicyUri,
+    Int32 SenderCertificateLength,
+    ListOfByte SenderCertificate,
+    Int32 ReceiverCertificateThumbprintLength,
+    ListOfByte ReceiverCertificateThumbprint
+  }
+
+  type record SymmetricSecurityHeader {
+    UInt32 TokenId
+  }
+
+  type record MessageFooter {
+    integer EncodingMask,
+    Byte PaddingSize optional,
+    ListOfByte Padding optional,
+    Byte ExtraPaddingSize optional,
+    ListOfByte Signature optional
+  }
+
+  type record AdditionalHeader {
+    ExpandedNodeId typeId,
+    Byte Value
+  }
+
+  type record RequestHeader {
+    SessionAuthenticationToken authenticationToken,
+    UtcTime timestamp,
+    IntegerId requestHandle,
+    UInt32 returnDiagnostics,
+    String auditEntryId,
+    UInt32 timeoutHint,
+    AdditionalHeader additionalHeader
+  }
+
+  type record ResponseHeader {
+    UtcTime timestamp,
+    IntegerId requestHandle,
+    StatusCode serviceResult,
+    DiagnosticInfo serviceDiagnostics,
+    ListOfString stringTable,
+    AdditionalHeader additionalHeader
+  }
+
+  type record ServiceFault {
+    ResponseHeader responseHeader
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                     Basic Messages                      //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record HelloMessage {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 version,
+    UInt32 receiveBufferSize,
+    UInt32 sendBufferSize,
+    UInt32 maxMessageSize,
+    UInt32 maxChunkCount,
+    String endPointUrl
+  }
+
+  type record AckMessage {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 version,
+    UInt32 receiveBufferSize,
+    UInt32 sendBufferSize,
+    UInt32 maxMessageSize,
+    UInt32 maxChunkCount
+  }
+
+  type record ErrorMessage {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 errorCode,
+    String reason
+  }
+
+  type record ReverseHelloMessage {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    String serverUri,
+    String endPointUrl
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                 Discovery Service Sets                  //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record FindServiceRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    String endpointUrl,
+    ListOfLocaleId localeIds,
+    ListOfString serverUris
+  }
+
+  type record FindServiceResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfApplicationDescription servers
+  }
+
+  type record FindServersOnNetworkRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    Counter startingRecordId,
+    UInt32 maxRecordsToReturn,
+    ListOfString serverCapabilityFilter
+  }
+
+  type record FindServersOnNetworkResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    UtcTime lastCounterResetTime,
+    ListOfServerOnNetwork servers
+  }
+
+  type record GetEndpointsRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    String endpointUrl,
+    ListOfLocaleId localeIds,
+    ListOfString profileUris
+  }
+
+  type record GetEndpointsResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfEndpointDescription Endpoints
+  }
+
+  type record RegisterServerRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    RegisteredServer server
+  }
+
+  type record RegisterServerResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader
+  }
+
+  type record RegisterServer2Request {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    RegisteredServer server,
+    ListOfExtensibleParameter discoveryConfiguration
+  }
+
+  type record RegisterServer2Response {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode configurationResults,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //               SecureChannel Service Sets                //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record OpenSecureChannelRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    ListOfByte securePolicyUri,
+    ListOfByte senderCertificate,
+    ListOfByte receiverCertificateThumbprint,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    UInt32 clientProtocolVersion,
+    SecurityTokenRequestType requestType,
+    MessageSecurityMode securityMode,
+    ByteString clientNonce,
+    UInt32 requestedLifetime
+  }
+
+  type record OpenSecureChannelResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    ListOfByte securePolicyUri,
+    ListOfByte senderCertificate,
+    ListOfByte receiverCertificateThumbprint,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    UInt32 serverProtocolVersion,
+    ChannelSecurityToken securityToken,
+    ByteString serverNonce
+  }
+
+  type record CloseSecureChannelRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader
+  }
+
+  type record CloseSecureChannelResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                Session Service Sets                     //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record CreateSessionRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ApplicationDescription clientDescription,
+    String serverUri,
+    String endpointUrl,
+    String sessionName,
+    ByteString clientNonce,
+    ByteString clientCertificate,
+    Duration requestedSessionTimeout,
+    UInt32 maxResponseMessageSize
+  }
+
+  type record CreateSessionResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    NodeId sessionId,
+    SessionAuthenticationToken authenticationToken,
+    Duration revisedSessionTimeout,
+    ByteString serverNonce,
+    ByteString serverCertificate,
+    ListOfEndpointDescription serverEndpoints,
+    ListOfSignedSoftwareCertificate serverSoftwareCertificates,
+    SignatureData serverSignature,
+    UInt32 maxRequestMessageSize
+  }
+
+  type record ActivateSessionRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    SignatureData clientSignature,
+    ListOfSignedSoftwareCertificate clientSoftwareCertificates,
+    ListOfLocaleId localeIds,
+    ExtensibleParameter userIdentityToken,
+    SignatureData userTokenSignature
+  }
+
+  type record ActivateSessionResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ByteString serverNonce,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record CloseSessionRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    Boolean deleteSubscriptions
+  }
+
+  type record CloseSessionResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader
+  }
+
+  type record CancelRequestRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId requestHandle
+  }
+
+  type record CancelRequestResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    UInt32 cancelCount
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //              NodeManagement Service Sets                //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record AddNodesRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfAddNodesItem nodesToAdd
+  }
+
+  type record AddNodesResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfAddNodesResult results
+  }
+
+  type record AddReferencesRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfAddReferencesItem referencesToAdd
+  }
+
+  type record AddReferencesResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record DeleteNodesRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfDeleteNodesItem nodesToDelete
+  }
+
+  type record DeleteNodesResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record DeleteReferencesRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfDeleteReferencesItem referencesToDelete
+  }
+
+  type record DeleteReferencesResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                 Browse Service Sets                     //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record BrowseRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ViewDescription view,
+    Counter requestedMaxReferencesPerNode,
+    ListOfBrowseDescription nodesToBrowse
+  }
+
+  type record BrowseResponse {
+    ResponseHeader responseHeader,
+    ListOfBrowseResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record BrowseNextRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    Boolean releaseContinuationPoints,
+    ListOfContinuationPoint continuationPoints
+  }
+
+  type record BrowseNextResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfBrowseResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record TranslateBrowsePathsToNodeIdsRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfBrowsePath browsePaths
+  }
+
+  type record TranslateBrowsePathsToNodeIdsResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfBrowsePathResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record RegisterNodesRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfNodeId nodesToRegister
+  }
+
+  type record RegisterNodesResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfNodeId registeredNodeIds
+  }
+
+  type record UnregisterNodesRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfNodeId nodesToUnregister
+  }
+
+  type record UnregisterNodesResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                 Query Service Set                       //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record QueryFirstRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfNodeTypeDescription nodeTypes,
+    ContentFilter filter,
+    Counter maxDataSetsToReturn,
+    Counter maxReferencesToReturn
+  }
+
+  type record QueryFirstResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfQueryDataSet queryDataSets,
+    ContinuationPoint continuationPoint,
+    ListOfParsingResult parsingResults,
+    ListOfDiagnosticInfo diagnosticInfos,
+    ContentFilterResult filterResult
+  }
+
+  type record QueryNextRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    Boolean releaseContinuationPoint,
+    ContinuationPoint continuationPoint
+  }
+
+  type record QueryNextResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfQueryDataSet queryDataSets,
+    ContinuationPoint revisedContinuationPoint
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                Attribute Service Set                    //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record ReadRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    Duration maxAge,
+    TimestampsToReturn timestampsToReturn,
+    ListOfReadValueId nodesToRead
+  }
+
+  type record ReadResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfDataValue results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record HistoryReadRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ExtensibleParameter historyReadDetails,
+    TimestampsToReturn timestampsToReturn,
+    Boolean releaseContinuationPoints,
+    ListOfHistoryReadValueId nodesToRead
+  }
+
+  type record HistoryReadResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfHistoryReadResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record WriteRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfWriteValue nodesToWrite
+  }
+
+  type record WriteResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record HistoryUpdateRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfExtensibleParameter historyUpdateDetails
+  }
+
+  type record HistoryUpdateResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfHistoryUpdateResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                   Method Service Set                    //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record CallRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfCallMethodRequest methodsToCall
+  }
+
+  type record CallResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfCallMethodResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                MonitoredItem Service Set                //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record CreateMonitoredItemsRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId subscriptionId,
+    TimestampsToReturn timestampsToReturn,
+    ListOfMonitoredItemCreateRequest itemsToCreate
+  }
+
+  type record CreateMonitoredItemsResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfMonitoredItemCreateResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record ModifyMonitoredItemsRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId subscriptionId,
+    TimestampsToReturn timestampsToReturn,
+    ListOfMonitoredItemModifyRequest itemsToModify
+  }
+
+  type record ModifyMonitoredItemsResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfMonitoredItemModifyResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record SetMonitoringModeRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId subscriptionId,
+    MonitoringMode monitoringMode,
+    ListOfIntegerId monitoredItemIds
+  }
+
+  type record SetMonitoringModeResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record SetTriggeringRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId subscriptionId,
+    IntegerId triggeringItemId,
+    ListOfIntegerId linksToAdd,
+    IntegerId linksToRemove
+  }
+
+  type record SetTriggeringResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode addResults,
+    ListOfDiagnosticInfo addDiagnosticInfos,
+    ListOfStatusCode removeResults,
+    ListOfDiagnosticInfo removeDiagnosticInfos
+  }
+
+  type record DeleteMonitoredItemsRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId subscriptionId,
+    ListOfIntegerId monitoredItemIds
+  }
+
+  type record DeleteMonitoredItemsResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                Subscription  Service Set                //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type record CreateSubscriptionRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    Duration requestedPublishingInterval,
+    Counter requestedLifetimeCount,
+    Counter requestedMaxKeepAliveCount,
+    Counter maxNotificationsPerPublish,
+    Boolean publishingEnabled,
+    Byte priorityInt32
+  }
+
+  type record CreateSubscriptionResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    IntegerId subscriptionId,
+    Duration revisedPublishingInterval,
+    Counter revisedLifetimeCount,
+    Counter revisedMaxKeepAliveCount
+  }
+
+  type record ModifySubscriptionRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId subscriptionId,
+    Duration requestedPublishingInterval,
+    Counter requestedLifetimeCount,
+    Counter requestedMaxKeepAliveCount,
+    Counter maxNotificationsPerPublish,
+    Byte priority
+  }
+
+  type record ModifySubscriptionResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    Duration revisedPublishingInterval,
+    Counter revisedLifetimeCount,
+    Counter revisedMaxKeepAliveCount
+  }
+
+  type record SetPublishingModeRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    Boolean publishingEnabled,
+    ListOfIntegerId subscriptionIds
+  }
+
+  type record SetPublishingModeResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record PublishRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfSubscriptionAcknowledgement subscriptionAcknowledgements
+  }
+
+  type record PublishResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    IntegerId subscriptionId,
+    ListOfCounter availableSequenceNumbers,
+    Boolean moreNotifications,
+    NotificationMessage notificationMessage,
+    record of StatusCode results,
+    record of DiagnosticInfo diagnosticInfos
+  }
+
+  type record RepublishRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    IntegerId subscriptionId,
+    Counter retransmitSequenceNumber
+  }
+
+  type record RepublishResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    NotificationMessage notificationMessage
+  }
+
+  type record TransferSubscriptionsRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfIntegerId subscriptionIds,
+    Boolean sendInitialValues
+  }
+
+  type record TransferSubscriptionsResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfTransferResult results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  type record DeleteSubscriptionsRequest {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    RequestHeader requestHeader,
+    ListOfIntegerId subscriptionIds
+  }
+
+  type record DeleteSubscriptionsResponse {
+    //Message header
+    UInt24 messageType,
+    Byte chunkType,
+    UInt32 messageSize,
+
+    //Message Body
+    UInt32 securityChannelId,
+    UInt32 securityTokenId,
+    SequenceHeader sequenceHeader,
+
+    //Service Header
+    Byte encodingByte,
+    Byte namespaceIndex,
+    UInt16 nodeValue,
+
+    //Service Body
+    ResponseHeader responseHeader,
+    ListOfStatusCode results,
+    ListOfDiagnosticInfo diagnosticInfos
+  }
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                Session-less Service                     //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  /*type record SessionlessInvokeRequest {
+    VersionTime urisVersion,
+    ListOfString namespaceUris,
+    ListOfString serverUris,
+    ListOfLocaleId localeIds,
+    UInt32 serviceId,
+    SessionlessServices body
+  }
+
+  type record SessionlessInvokeResponse {
+    ListOfString namespaceUris,
+    ListOfString serverUris,
+    UInt32 serviceId,
+    SessionlessServices body
+  }*/
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //                    Encoded Types                        //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  type union MessageTypes {
+    //BasicMessages
+    HelloMessage HelloMessage,
+    AckMessage AckMessage,
+    ErrorMessage ErrorMessage,
+    ReverseHelloMessage ReverseHelloMessage,
+
+    //DiscoveryServices
+    FindServiceRequest FindServiceRequest,
+    FindServiceResponse FindServiceResponse,
+    FindServersOnNetworkRequest FindServersOnNetworkRequest,
+    FindServersOnNetworkResponse FindServersOnNetworkResponse,
+    GetEndpointsRequest GetEndpointsRequest,
+    GetEndpointsResponse GetEndpointsResponse,
+    RegisterServerRequest RegisterServerRequest,
+    RegisterServerResponse RegisterServerResponse,
+    RegisterServer2Request RegisterServer2Request,
+    RegisterServer2Response RegisterServer2Response,
+
+    //Secure Channel services
+    OpenSecureChannelRequest OpenSecureChannelRequest,
+    OpenSecureChannelResponse OpenSecureChannelResponse,
+    CloseSecureChannelRequest CloseSecureChannelRequest,
+    CloseSecureChannelResponse CloseSecureChannelResponse,
+
+    //Session Services
+    CreateSessionRequest CreateSessionRequest,
+    CreateSessionResponse CreateSessionResponse,
+    ActivateSessionRequest ActivateSessionRequest,
+    ActivateSessionResponse ActivateSessionResponse,
+    CloseSessionRequest CloseSessionRequest,
+    CloseSessionResponse CloseSessionResponse,
+    CancelRequestRequest CancelRequestRequest,
+    CancelRequestResponse CancelRequestResponse,
+
+    //Node Management Services
+    AddNodesRequest AddNodesRequest,
+    AddNodesResponse AddNodesResponse,
+    AddReferencesRequest AddReferencesRequest,
+    AddReferencesResponse AddReferencesResponse,
+    DeleteNodesRequest DeleteNodesRequest,
+    DeleteNodesResponse DeleteNodesResponse,
+    DeleteReferencesRequest DeleteReferencesRequest,
+    DeleteReferencesResponse DeleteReferencesResponse,
+
+    //View Services
+    BrowseRequest BrowseRequest,
+    BrowseResponse BrowseResponse,
+    BrowseNextRequest BrowseNextRequest,
+    BrowseNextResponse BrowseNextResponse,
+    TranslateBrowsePathsToNodeIdsRequest TranslateBrowsePathsToNodeIdsRequest,
+    TranslateBrowsePathsToNodeIdsResponse TranslateBrowsePathsToNodeIdsResponse,
+    RegisterNodesRequest RegisterNodesRequest,
+    RegisterNodesResponse RegisterNodesResponse,
+    UnregisterNodesRequest UnregisterNodesRequest,
+    UnregisterNodesResponse UnregisterNodesResponse,
+
+    //Query Services
+    QueryFirstRequest QueryFirstRequest,
+    QueryFirstResponse QueryFirstResponse,
+    QueryNextRequest QueryNextRequest,
+    QueryNextResponse QueryNextResponse,
+
+    //Attribute Services
+    ReadRequest ReadRequest,
+    ReadResponse ReadResponse,
+    HistoryReadRequest HistoryReadRequest,
+    HistoryReadResponse HistoryReadResponse,
+    WriteRequest WriteRequest,
+    WriteResponse WriteResponse,
+
+    //Method Services
+    HistoryUpdateRequest HistoryUpdateRequest,
+    HistoryUpdateResponse HistoryUpdateResponse,
+    CallRequest CallRequest,
+    CallResponse CallResponse,
+
+    //Monitored Item Services
+    CreateMonitoredItemsRequest CreateMonitoredItemsRequest,
+    CreateMonitoredItemsResponse CreateMonitoredItemsResponse,
+    ModifyMonitoredItemsRequest ModifyMonitoredItemsRequest,
+    ModifyMonitoredItemsResponse ModifyMonitoredItemsResponse,
+    SetMonitoringModeRequest SetMonitoringModeRequest,
+    SetMonitoringModeResponse SetMonitoringModeResponse,
+    SetTriggeringRequest SetTriggeringRequest,
+    SetTriggeringResponse SetTriggeringResponse,
+    DeleteMonitoredItemsRequest DeleteMonitoredItemsRequest,
+    DeleteMonitoredItemsResponse DeleteMonitoredItemsResponse,
+
+    //Subscription Services
+    CreateSubscriptionRequest CreateSubscriptionRequest,
+    CreateSubscriptionResponse CreateSubscriptionResponse,
+    ModifySubscriptionRequest ModifySubscriptionRequest,
+    ModifySubscriptionResponse ModifySubscriptionResponse,
+    SetPublishingModeRequest SetPublishingModeRequest,
+    SetPublishingModeResponse SetPublishingModeResponse,
+    PublishRequest PublishRequest,
+    PublishResponse PublishResponse,
+    RepublishRequest RepublishRequest,
+    RepublishResponse RepublishResponse,
+    TransferSubscriptionsRequest TransferSubscriptionsRequest,
+    TransferSubscriptionsResponse TransferSubscriptionsResponse,
+    DeleteSubscriptionsRequest DeleteSubscriptionsRequest,
+    DeleteSubscriptionsResponse DeleteSubscriptionsResponse,
+
+    //Sessionless Invoke Services
+    //SessionlessInvokeRequest SessionlessInvokeRequest,
+    //SessionlessInvokeResponse  SessionlessInvokeResponse,
+
+    ReadRequest readRequest,
+    ReadResponse readResponse,
+    WriteRequest writeRequest,
+    WriteResponse writeResponse,
+    CallRequest callRequest,
+    CallResponse callResponse
+  } with {
+    variant "JSON: as value"
+  }
+
+} with { encode "JSON" }
\ No newline at end of file
diff --git a/test/OpcUa.cfg b/test/OpcUa.cfg
index 400aa27..3438c0b 100644
--- a/test/OpcUa.cfg
+++ b/test/OpcUa.cfg
@@ -35,4 +35,5 @@
 LogEntityName := Yes

 

 [EXECUTE]

-OpcUa_Test.control
\ No newline at end of file
+OpcUa_Test_Binary.control

+OpcUa_Test_JSON.control
\ No newline at end of file
diff --git a/test/OpcUa_Message_Templates.ttcn b/test/OpcUa_Message_Templates.ttcn
index af0757e..29ea43e 100644
--- a/test/OpcUa_Message_Templates.ttcn
+++ b/test/OpcUa_Message_Templates.ttcn
@@ -396,7 +396,7 @@
       sessionName := valueof(tr_String( "Session1" )),

       clientNonce := valueof(tr_ByteString( {103, 70, 147, 188, 171, 213, 166, 143, 188, 174, 139, 130, 248, 135, 93, 222, 115, 134, 67, 84, 89, 51, 182, 246, 95, 47, 244, 69, 162, 87, 120, 54} )),

       clientCertificate := valueof(tr_ByteString( { 48, 130, 4, 172, 48, 130, 3, 148, 160, 3, 2, 1, 2, 2, 9, 0, 193, 232, 116, 99, 18, 62, 6, 87, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 88, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 70, 82, 49, 12, 48, 10, 6, 3, 85, 4, 8, 19, 3, 73, 68, 70, 49, 14, 48, 12, 6, 3, 85, 4, 7, 19, 5, 80, 97, 114, 105, 115, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 23, 48, 21, 6, 3, 85, 4, 3, 19, 14, 78, 111, 100, 101, 79, 80, 67, 85, 65, 45, 84, 69, 83, 84, 48, 30, 23, 13, 49, 55, 49, 48, 49, 57, 48, 57, 50, 53, 51, 50, 90, 23, 13, 51, 50, 49, 48, 49, 53, 48, 57, 50, 53, 51, 50, 90, 48, 88, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 70, 82, 49, 12, 48, 10, 6, 3, 85, 4, 8, 19, 3, 73, 68, 70, 49, 14, 48, 12, 6, 3, 85, 4, 7, 19, 5, 80, 97, 114, 105, 115, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 23, 48, 21, 6, 3, 85, 4, 3, 19, 14, 78, 111, 100, 101, 79, 80, 67, 85, 65, 45, 84, 69, 83, 84, 48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 162, 249, 118, 193, 122, 59, 9, 123, 20, 81, 132, 230, 222, 31, 81, 153, 95, 230, 235, 165, 119, 149, 47, 216, 100, 87, 85, 235, 155, 201, 46, 49, 153, 192, 135, 198, 208, 239, 3, 173, 127, 215, 133, 117, 6, 21, 120, 154, 177, 14, 220, 215, 143, 17, 104, 15, 105, 187, 57, 59, 145, 222, 79, 62, 112, 222, 116, 40, 83, 121, 96, 179, 7, 77, 67, 70, 91, 253, 110, 243, 2, 81, 104, 228, 225, 144, 127, 148, 248, 156, 216, 58, 197, 3, 51, 50, 199, 161, 26, 172, 237, 196, 225, 4, 6, 119, 147, 181, 126, 190, 36, 200, 233, 199, 193, 65, 191, 36, 90, 76, 127, 20, 121, 206, 146, 82, 191, 69, 5, 49, 212, 72, 182, 75, 41, 131, 110, 194, 181, 235, 28, 96, 205, 132, 150, 179, 171, 90, 170, 66, 190, 90, 141, 117, 180, 203, 175, 232, 36, 50, 221, 64, 115, 64, 13, 0, 84, 195, 97, 154, 52, 5, 156, 114, 95, 30, 192, 69, 179, 74, 148, 67, 181, 216, 51, 129, 195, 120, 211, 1, 114, 14, 148, 139, 211, 231, 91, 128, 26, 63, 36, 99, 193, 148, 251, 251, 76, 231, 95, 84, 68, 212, 235, 101, 119, 68, 15, 238, 199, 232, 239, 3, 228, 124, 41, 133, 193, 108, 180, 218, 49, 13, 140, 13, 43, 187, 108, 60, 6, 163, 251, 202, 53, 180, 177, 141, 114, 45, 39, 236, 196, 248, 61, 33, 142, 215, 2, 3, 1, 0, 1, 163, 130, 1, 119, 48, 130, 1, 115, 48, 29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 17, 124, 191, 30, 233, 154, 127, 115, 204, 254, 168, 65, 112, 82, 167, 146, 191, 42, 85, 25, 48, 129, 137, 6, 3, 85, 29, 35, 4, 129, 129, 48, 127, 128, 20, 17, 124, 191, 30, 233, 154, 127, 115, 204, 254, 168, 65, 112, 82, 167, 146, 191, 42, 85, 25, 161, 92, 164, 90, 48, 88, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 70, 82, 49, 12, 48, 10, 6, 3, 85, 4, 8, 19, 3, 73, 68, 70, 49, 14, 48, 12, 6, 3, 85, 4, 7, 19, 5, 80, 97, 114, 105, 115, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 23, 48, 21, 6, 3, 85, 4, 3, 19, 14, 78, 111, 100, 101, 79, 80, 67, 85, 65, 45, 84, 69, 83, 84, 130, 9, 0, 193, 232, 116, 99, 18, 62, 6, 87, 48, 12, 6, 3, 85, 29, 19, 4, 5, 48, 3, 1, 1, 255, 48, 14, 6, 3, 85, 29, 15, 1, 1, 255, 4, 4, 3, 2, 1, 6, 48, 95, 6, 9, 96, 134, 72, 1, 134, 248, 66, 1, 13, 4, 82, 22, 80, 83, 101, 108, 102, 83, 105, 103, 110, 101, 100, 32, 67, 101, 114, 116, 105, 102, 105, 99, 97, 116, 101, 32, 103, 101, 110, 101, 114, 97, 116, 101, 100, 32, 98, 121, 32, 78, 111, 100, 101, 45, 79, 80, 67, 85, 65, 32, 67, 101, 114, 116, 105, 102, 105, 99, 97, 116, 101, 32, 117, 116, 105, 108, 105, 116, 121, 32, 117, 115, 105, 110, 103, 32, 111, 112, 101, 110, 115, 115, 108, 48, 71, 6, 3, 85, 29, 17, 4, 64, 48, 62, 134, 40, 117, 114, 110, 58, 122, 109, 97, 107, 97, 107, 111, 45, 86, 105, 114, 116, 117, 97, 108, 66, 111, 120, 58, 78, 111, 100, 101, 45, 79, 80, 67, 85, 65, 45, 83, 101, 114, 118, 101, 114, 130, 18, 122, 109, 97, 107, 97, 107, 111, 45, 86, 105, 114, 116, 117, 97, 108, 66, 111, 120, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 3, 130, 1, 1, 0, 22, 137, 144, 225, 128, 121, 63, 231, 142, 198, 56, 192, 141, 111, 226, 217, 215, 23, 136, 6, 246, 32, 201, 216, 83, 191, 107, 116, 101, 236, 227, 174, 40, 89, 16, 196, 106, 206, 58, 44, 57, 190, 231, 202, 222, 55, 3, 168, 5, 103, 54, 33, 245, 247, 158, 62, 14, 112, 252, 208, 199, 100, 88, 213, 165, 102, 115, 74, 184, 43, 25, 9, 189, 163, 137, 161, 77, 181, 46, 144, 124, 165, 161, 118, 16, 41, 139, 181, 209, 148, 149, 224, 171, 144, 145, 100, 226, 44, 24, 66, 28, 51, 227, 20, 25, 83, 242, 103, 94, 196, 143, 192, 51, 243, 186, 84, 113, 168, 82, 52, 244, 119, 221, 183, 151, 180, 112, 254, 132, 85, 243, 150, 149, 132, 233, 19, 190, 98, 178, 166, 90, 4, 136, 187, 43, 107, 11, 96, 124, 28, 0, 114, 9, 225, 161, 234, 23, 18, 67, 210, 67, 62, 65, 72, 55, 22, 82, 33, 147, 226, 174, 198, 179, 177, 213, 77, 54, 146, 15, 11, 109, 169, 116, 143, 70, 183, 213, 36, 114, 114, 131, 3, 164, 221, 35, 226, 221, 20, 11, 15, 248, 241, 151, 61, 229, 12, 151, 80, 69, 33, 56, 204, 248, 42, 78, 185, 61, 146, 254, 196, 188, 51, 129, 226, 133, 167, 193, 58, 159, 148, 222, 249, 96, 143, 122, 178, 30, 201, 40, 197, 240, 101, 58, 71, 87, 229, 138, 96, 24, 191, 194, 35, 23, 123, 136, 20} )),

-      requestedSessionTimeout := 60000.0,  //TODO: fix float encodig

+      requestedSessionTimeout := 60000.0,

       maxResponseMessageSize := 800000

     }

 

diff --git a/test/OpcUa_Test.ttcn b/test/OpcUa_Test_Binary.ttcn
similarity index 98%
rename from test/OpcUa_Test.ttcn
rename to test/OpcUa_Test_Binary.ttcn
index 4322c38..82d3c9f 100644
--- a/test/OpcUa_Test.ttcn
+++ b/test/OpcUa_Test_Binary.ttcn
@@ -1,500 +1,500 @@
-/////////////////////////////////////////////////////////////////////////////////////

-// Copyright (c) 2017-2018  Ericsson AB

-// All rights reserved. This program and the accompanying materials

-// are made available under the terms of the Eclipse Public License v1.0

-// which accompanies this distribution, and is available at

-// http://www.eclipse.org/legal/epl-v10.html

-/////////////////////////////////////////////////////////////////////////////////////

-// Contributors:

-// Akos Makovics

-//

-//  File:         UpcUa_Test.ttcn

-//  Rev:          <RnXnn>

-//  Prodnr:       CNL113861

-/////////////////////////////////////////////////////////////////////////////////////

-

-module OpcUa_Test {

-

-  import from IPL4asp_PortType all;

-

-  import from OpcUa_Functions all;

-  import from OpcUa_Types_Binary all;

-

-  import from OpcUa_Encoded_Messages all;

-  import from OpcUa_Message_Templates all;

-

-  type component MyComp {}

-

-  type component SendReceiveComp {

-        port IPL4asp_PT testPort;

-        var integer connId;

-  }

-

-  // local and remote TCP host/port

-  modulepar { OpcUa_Functions.ConnectionData LocalTCPConnection, RemoteTCPConnection }

-

-

-  function f_encDec_Binary_Message (in MessageChunk pl_in) runs on MyComp {

-    log("==========================================================================");

-    log("f_encDec_Binary_Message Enter");

-

-     var octetstring v_encodedMessage;

-     var octetstring v_secondEncodedMessage;

-     var MessageChunk v_decodedMessage;

-

-     var integer v_messageType := pl_in.header.messageType;

-

-     if (v_messageType == 4998472 or v_messageType == 4932417 or v_messageType == 5395013 or v_messageType == 4540498 ) {

-      log("Message type: Transport Message");

-    } else {

-      log("Message type: Service, message contains body");

-

-      var ServiceBody body;

-

-      if (dec_ServiceBody(pl_in.body, body) == -1) {

-        setverdict(fail, "Failed to decode service body!");

-      }

-

-      var octetstring encodedBody := enc_ServiceBody(body);

-

-      if (encodedBody != pl_in.body) {

-        setverdict(fail, "Service body encoding has failed!");

-      }

-    }

-

-    v_encodedMessage := enc_MessageChunk(pl_in);

-

-    if (dec_MessageChunk(v_encodedMessage, v_decodedMessage) == -1) {

-      setverdict ( fail, "Failed to encode message!" );

-      return;

-    }

-

-    v_secondEncodedMessage :=  enc_MessageChunk(v_decodedMessage);

-

-    if (v_encodedMessage == v_secondEncodedMessage) {

-      setverdict ( pass, "Message succesfully encoded and decoded!" );

-    } else {

-      setverdict ( fail, "First and second encoding yielded a different result!" );

-    }

-  }

-

-  function f_encDec_OpcUa_MessageChunk(in octetstring pl_in) runs on MyComp

-  {

-

-    log("==========================================================================");

-    log("f_encDec_OpcUa_Message Enter");

-

-    var MessageChunk v_decodedChunk;

-    var octetstring v_encodedChunk;

-

-    if (dec_MessageChunk(pl_in, v_decodedChunk) == -1) {

-      setverdict(fail, "Failed to decode message chunk!");

-      return;

-    }

-

-    var integer v_messageType := v_decodedChunk.header.messageType;

-

-    if (v_messageType == 4998472 or v_messageType == 4932417 or v_messageType == 5395013 or v_messageType == 4540498 ) {

-      log("Message type: Transport Message");

-    } else {

-      log("Message type: Service");

-

-      var ServiceBody body;

-

-      if (dec_ServiceBody(v_decodedChunk.body, body) == -1) {

-        setverdict(fail, "Failed to decode service!");

-      }

-

-      v_decodedChunk.body := enc_ServiceBody(body);

-    }

-

-    v_encodedChunk := enc_MessageChunk(v_decodedChunk);

-

-    if (pl_in == v_encodedChunk) {

-      setverdict(pass);

-    } else {

-      setverdict(fail);

-    }

-  }

-

-

-

-  function f_connectToServer() runs on SendReceiveComp {

-    connId := CreateConnection(testPort, LocalTCPConnection, RemoteTCPConnection);

-    if (connId != -1) {

-      setverdict(pass, "Connection established!");

-    } else {

-      setverdict(fail, "Failed to create connection!");

-    }

-  }

-

-  function f_closeConnectToServer() runs on SendReceiveComp {

-    if (CloseConnection(testPort, connId)) {

-      setverdict(pass, "Connection closed!");

-    } else {

-      setverdict(fail, "Failed to close connection!");

-    }

-  }

-

-  function f_sendMessagesToServer() runs on SendReceiveComp {

-    connId := CreateConnection(testPort, LocalTCPConnection, RemoteTCPConnection);

-    if (connId == -1) {

-      setverdict(fail, "Failed to create connection!");

-      return;

-    }

-

-    f_sendReceive_Message(f_GetHelloMessage(), f_GetAckMessage(), true);

-    f_sendReceive_Message(f_GetOpenSecureChannelRequest(), f_GetOpenSecureChannelResponse(), true);

-    f_sendReceive_Message(f_GetEndpointsRequest(), f_GetServiceResponse(), true);

-    f_sendReceive_Message(f_GetCreateSessionRequest(), f_GetServiceResponse(), true);

-    f_sendReceive_Message(f_GetActivateSessionRequest(), f_GetServiceResponse(), true);

-    f_sendReceive_Message(f_GetBrowseRequest(), f_GetServiceResponse(), true);

-    f_sendReceive_Message(f_GetReadRequest(), f_GetServiceResponse(), true);

-    f_sendReceive_Message(f_GetCreateSubscRequest(), f_GetServiceResponse(), true);

-    f_sendReceive_Message(f_GetCloseSessionRequest(), f_GetServiceResponse(), true);

-    f_sendReceive_Message(f_GetCloseSecureChannelRequest(), omit, false);

-

-    if (not CloseConnection(testPort, connId)) {

-      setverdict(fail, "Failed to close connection!");

-    }

-  }

-

-  //Sends an encoded message, and matches the reply with a template

-  function f_sendReceive_Message(in octetstring msgToSend, in template MessageChunk expectedMsg, in boolean expectReply) runs on SendReceiveComp {

-    var octetstring actualMsg;

-

-     SendMessage(testPort, RemoteTCPConnection, connId, msgToSend);

-

-     if (expectReply) {

-       if (ReceiveMessage(testPort, actualMsg)) {

-         var MessageChunk v_decodedMessage; //Expected msg

-

-         //Decode message

-         if (dec_MessageChunk(actualMsg, v_decodedMessage) == -1) {

-           setverdict(fail, "Received reply, but unable to decode it!");

-         }

-

-         if (match(v_decodedMessage, expectedMsg)) {

-            setverdict(pass, "Received expected reply!");

-          } else {

-            setverdict(fail, "Received unexpeted reply!");

-          }

-       } else {

-         setverdict(fail, "Failed to receive response!");

-       }

-     } else {

-       setverdict(pass, "Message sent!");

-     }

-  }

-

-  testcase tc_dec_Hello() runs on MyComp {

-    const octetstring v_msg := encodedBinaryHello;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_Ack() runs on MyComp {

-    const octetstring v_msg := encodedBinaryAck;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_Err() runs on MyComp {

-    const octetstring v_msg := encodedBinaryError;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_OpenSecReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryOpenSecReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_OpenSecResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryOpenSecResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CloseSecReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCloseSecReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_GetEndpointsReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryGetEndointsReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_GetEndpointsResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryGetEndointsResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CreateSessionReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCreateSessionReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CreateSessionResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCreateSessionResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_ActivateSessionReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryActivateSessionReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_ActivateSessionResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryActivateSessionResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_BrowseReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryBrowseReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_BrowseResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryBrowseResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_ReadReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryReadReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_ReadResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryReadResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CreateSubscReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCreateSubscReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CreateSubscResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCreateSubscResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CreateMonitoredItemReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCreateMonitoredItemReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CreateMonitoredItemResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCreateMonitoredItemResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_PublishReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryPublishReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_PublishResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryPublishResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_DeleteSubscReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryDeleteSubsReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_DeleteSubscResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryDeleteSubsResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CloseSessionReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryClodeSessionReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CloseSessionResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryClodeSessionResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_TranslateBrowsePathsToNodeIdsReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryTranslateBrowsePathsToNodeIdsReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_TranslateBrowsePathsToNodeIdsResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryTranslateBrowsePathsToNodeIdsResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_SetPublishingModeReq() runs on MyComp {

-    const octetstring v_msg := encodedBinarySetPublishingModeReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_SetPublishingModeResp() runs on MyComp {

-    const octetstring v_msg := encodedBinarySetPublishingModeResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CallReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCallReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_CallResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryCallResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_SetMonitoringModeReq() runs on MyComp {

-    const octetstring v_msg := encodedBinarySetMonitoringModeReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_SetMonitoringModeResp() runs on MyComp {

-    const octetstring v_msg := encodedBinarySetMonitoringModeResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_ModifyMonitoredItemReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryModifyMonitoredItemReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_ModifyMonitoredItemResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryModifyMonitoredItemResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_WriteReq() runs on MyComp {

-    const octetstring v_msg := encodedBinaryWriteReq;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-  testcase tc_dec_WriteResp() runs on MyComp {

-    const octetstring v_msg := encodedBinaryWriteResp;

-    f_encDec_OpcUa_MessageChunk(v_msg);

-  }

-

-

-  testcase tc_encDec_Hello() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetHelloMessage());

-  }

-

-  testcase tc_encDec_OpenSecureChannelReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetOpenSecureChannelRequest());

-  }

-

-  testcase tc_encDec_EndpointsReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetEndpointsRequest());

-  }

-

-  testcase tc_encDec_CreateSessionReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetCreateSessionRequest());

-  }

-

-  testcase tc_encDec_ActivateSessionReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetActivateSessionRequest());

-  }

-

-  testcase tc_encDec_GetBrowseReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetBrowseRequest());

-  }

-

-  testcase tc_encDec_GetReadReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetReadRequest());

-  }

-

-  testcase tc_encDec_CreateSubscReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetCreateSubscRequest());

-  }

-

-  testcase tc_encDec_CloseSessionReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetCloseSessionRequest());

-  }

-

-  testcase tc_encDec_CloseSecureChannelReq() runs on MyComp {

-    f_encDec_OpcUa_MessageChunk(f_GetCloseSecureChannelRequest());

-  }

-

-  testcase tc_sendMessagesToServer() runs on SendReceiveComp {

-     map(mtc:testPort, system:testPort);

-    f_sendMessagesToServer();

-  }

-

-  control {

-    //Decode and test encoded messages from Wireshark

-    execute(tc_dec_Hello());

-    execute(tc_dec_Ack());

-    execute(tc_dec_Err());

-

-    execute(tc_dec_OpenSecReq());

-    execute(tc_dec_OpenSecResp());

-

-    execute(tc_dec_CloseSecReq());

-

-    execute(tc_dec_GetEndpointsReq());

-    execute(tc_dec_GetEndpointsResp());

-

-    execute(tc_dec_CreateSessionReq());

-    execute(tc_dec_CreateSessionResp());

-

-    execute(tc_dec_ActivateSessionReq());

-    execute(tc_dec_ActivateSessionResp());

-

-    execute(tc_dec_BrowseReq());

-    execute(tc_dec_BrowseResp());

-

-    execute(tc_dec_ReadReq());

-    execute(tc_dec_ReadResp());

-

-    execute(tc_dec_CreateSubscReq());

-    execute(tc_dec_CreateSubscResp());

-

-    execute(tc_dec_CreateMonitoredItemReq());

-    execute(tc_dec_CreateMonitoredItemResp());

-

-    execute(tc_dec_DeleteSubscReq());

-    execute(tc_dec_DeleteSubscResp());

-

-    execute(tc_dec_PublishReq());

-    execute(tc_dec_PublishResp());

-

-    execute(tc_dec_CloseSessionReq());

-    execute(tc_dec_CloseSessionResp());

-

-    execute(tc_dec_TranslateBrowsePathsToNodeIdsReq());

-    execute(tc_dec_TranslateBrowsePathsToNodeIdsResp());

-

-    execute(tc_dec_SetPublishingModeReq());

-    execute(tc_dec_SetPublishingModeResp());

-

-    execute(tc_dec_SetMonitoringModeReq());

-    execute(tc_dec_SetMonitoringModeResp());

-

-    execute(tc_dec_CallReq());

-    execute(tc_dec_CallResp());

-

-    execute(tc_dec_ModifyMonitoredItemReq());

-    execute(tc_dec_ModifyMonitoredItemResp());

-

-    execute(tc_dec_WriteReq());

-    execute(tc_dec_WriteResp());

-

-    //Encode and decode Messages created from TTCN structures

-    execute(tc_encDec_Hello());

-    execute(tc_encDec_OpenSecureChannelReq());

-    execute(tc_encDec_EndpointsReq());

-    execute(tc_encDec_CreateSessionReq());

-    execute(tc_encDec_ActivateSessionReq());

-    execute(tc_encDec_GetBrowseReq());

-    execute(tc_encDec_GetReadReq());

-    execute(tc_encDec_CreateSubscReq());

-    execute(tc_encDec_CloseSessionReq());

-    execute(tc_encDec_CloseSecureChannelReq());

-

-    //Encode and send TTCN messages to a local OPC server

-    execute (tc_sendMessagesToServer());

-  }

+/////////////////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2017-2018  Ericsson AB
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+/////////////////////////////////////////////////////////////////////////////////////
+// Contributors:
+// Akos Makovics
+//
+//  File:         OpcUa_Test_Binary.ttcn
+//  Rev:          <RnXnn>
+//  Prodnr:       CNL113861
+/////////////////////////////////////////////////////////////////////////////////////
+
+module OpcUa_Test_Binary {
+
+  import from IPL4asp_PortType all;
+
+  import from OpcUa_Functions all;
+  import from OpcUa_Types_Binary all;
+
+  import from OpcUa_Encoded_Messages all;
+  import from OpcUa_Message_Templates all;
+
+  type component MyComp {}
+
+  type component SendReceiveComp {
+        port IPL4asp_PT testPort;
+        var integer connId;
+  }
+
+  // local and remote TCP host/port
+  modulepar { OpcUa_Functions.ConnectionData LocalTCPConnection, RemoteTCPConnection }
+
+
+  function f_encDec_Binary_Message (in MessageChunk pl_in) runs on MyComp {
+    log("==========================================================================");
+    log("f_encDec_Binary_Message Enter");
+
+     var octetstring v_encodedMessage;
+     var octetstring v_secondEncodedMessage;
+     var MessageChunk v_decodedMessage;
+
+     var integer v_messageType := pl_in.header.messageType;
+
+     if (v_messageType == 4998472 or v_messageType == 4932417 or v_messageType == 5395013 or v_messageType == 4540498 ) {
+      log("Message type: Transport Message");
+    } else {
+      log("Message type: Service, message contains body");
+
+      var ServiceBody body;
+
+      if (dec_ServiceBody(pl_in.body, body) == -1) {
+        setverdict(fail, "Failed to decode service body!");
+      }
+
+      var octetstring encodedBody := enc_ServiceBody(body);
+
+      if (encodedBody != pl_in.body) {
+        setverdict(fail, "Service body encoding has failed!");
+      }
+    }
+
+    v_encodedMessage := enc_MessageChunk(pl_in);
+
+    if (dec_MessageChunk(v_encodedMessage, v_decodedMessage) == -1) {
+      setverdict ( fail, "Failed to encode message!" );
+      return;
+    }
+
+    v_secondEncodedMessage :=  enc_MessageChunk(v_decodedMessage);
+
+    if (v_encodedMessage == v_secondEncodedMessage) {
+      setverdict ( pass, "Message succesfully encoded and decoded!" );
+    } else {
+      setverdict ( fail, "First and second encoding yielded a different result!" );
+    }
+  }
+
+  function f_encDec_OpcUa_MessageChunk(in octetstring pl_in) runs on MyComp
+  {
+
+    log("==========================================================================");
+    log("f_encDec_OpcUa_Message Enter");
+
+    var MessageChunk v_decodedChunk;
+    var octetstring v_encodedChunk;
+
+    if (dec_MessageChunk(pl_in, v_decodedChunk) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    var integer v_messageType := v_decodedChunk.header.messageType;
+
+    if (v_messageType == 4998472 or v_messageType == 4932417 or v_messageType == 5395013 or v_messageType == 4540498 ) {
+      log("Message type: Transport Message");
+    } else {
+      log("Message type: Service");
+
+      var ServiceBody body;
+
+      if (dec_ServiceBody(v_decodedChunk.body, body) == -1) {
+        setverdict(fail, "Failed to decode service!");
+      }
+
+      v_decodedChunk.body := enc_ServiceBody(body);
+    }
+
+    v_encodedChunk := enc_MessageChunk(v_decodedChunk);
+
+    if (pl_in == v_encodedChunk) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+
+
+  function f_connectToServer() runs on SendReceiveComp {
+    connId := CreateConnection(testPort, LocalTCPConnection, RemoteTCPConnection);
+    if (connId != -1) {
+      setverdict(pass, "Connection established!");
+    } else {
+      setverdict(fail, "Failed to create connection!");
+    }
+  }
+
+  function f_closeConnectToServer() runs on SendReceiveComp {
+    if (CloseConnection(testPort, connId)) {
+      setverdict(pass, "Connection closed!");
+    } else {
+      setverdict(fail, "Failed to close connection!");
+    }
+  }
+
+  function f_sendMessagesToServer() runs on SendReceiveComp {
+    connId := CreateConnection(testPort, LocalTCPConnection, RemoteTCPConnection);
+    if (connId == -1) {
+      setverdict(fail, "Failed to create connection!");
+      return;
+    }
+
+    f_sendReceive_Message(f_GetHelloMessage(), f_GetAckMessage(), true);
+    f_sendReceive_Message(f_GetOpenSecureChannelRequest(), f_GetOpenSecureChannelResponse(), true);
+    f_sendReceive_Message(f_GetEndpointsRequest(), f_GetServiceResponse(), true);
+    f_sendReceive_Message(f_GetCreateSessionRequest(), f_GetServiceResponse(), true);
+    f_sendReceive_Message(f_GetActivateSessionRequest(), f_GetServiceResponse(), true);
+    f_sendReceive_Message(f_GetBrowseRequest(), f_GetServiceResponse(), true);
+    f_sendReceive_Message(f_GetReadRequest(), f_GetServiceResponse(), true);
+    f_sendReceive_Message(f_GetCreateSubscRequest(), f_GetServiceResponse(), true);
+    f_sendReceive_Message(f_GetCloseSessionRequest(), f_GetServiceResponse(), true);
+    f_sendReceive_Message(f_GetCloseSecureChannelRequest(), omit, false);
+
+    if (not CloseConnection(testPort, connId)) {
+      setverdict(fail, "Failed to close connection!");
+    }
+  }
+
+  //Sends an encoded message, and matches the reply with a template
+  function f_sendReceive_Message(in octetstring msgToSend, in template MessageChunk expectedMsg, in boolean expectReply) runs on SendReceiveComp {
+    var octetstring actualMsg;
+
+     SendMessage(testPort, RemoteTCPConnection, connId, msgToSend);
+
+     if (expectReply) {
+       if (ReceiveMessage(testPort, actualMsg)) {
+         var MessageChunk v_decodedMessage; //Expected msg
+
+         //Decode message
+         if (dec_MessageChunk(actualMsg, v_decodedMessage) == -1) {
+           setverdict(fail, "Received reply, but unable to decode it!");
+         }
+
+         if (match(v_decodedMessage, expectedMsg)) {
+            setverdict(pass, "Received expected reply!");
+          } else {
+            setverdict(fail, "Received unexpeted reply!");
+          }
+       } else {
+         setverdict(fail, "Failed to receive response!");
+       }
+     } else {
+       setverdict(pass, "Message sent!");
+     }
+  }
+
+  testcase tc_dec_Hello() runs on MyComp {
+    const octetstring v_msg := encodedBinaryHello;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_Ack() runs on MyComp {
+    const octetstring v_msg := encodedBinaryAck;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_Err() runs on MyComp {
+    const octetstring v_msg := encodedBinaryError;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_OpenSecReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryOpenSecReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_OpenSecResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryOpenSecResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CloseSecReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCloseSecReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_GetEndpointsReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryGetEndointsReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_GetEndpointsResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryGetEndointsResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CreateSessionReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCreateSessionReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CreateSessionResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCreateSessionResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_ActivateSessionReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryActivateSessionReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_ActivateSessionResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryActivateSessionResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_BrowseReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryBrowseReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_BrowseResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryBrowseResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_ReadReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryReadReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_ReadResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryReadResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CreateSubscReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCreateSubscReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CreateSubscResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCreateSubscResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CreateMonitoredItemReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCreateMonitoredItemReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CreateMonitoredItemResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCreateMonitoredItemResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_PublishReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryPublishReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_PublishResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryPublishResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_DeleteSubscReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryDeleteSubsReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_DeleteSubscResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryDeleteSubsResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CloseSessionReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryClodeSessionReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CloseSessionResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryClodeSessionResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_TranslateBrowsePathsToNodeIdsReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryTranslateBrowsePathsToNodeIdsReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_TranslateBrowsePathsToNodeIdsResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryTranslateBrowsePathsToNodeIdsResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_SetPublishingModeReq() runs on MyComp {
+    const octetstring v_msg := encodedBinarySetPublishingModeReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_SetPublishingModeResp() runs on MyComp {
+    const octetstring v_msg := encodedBinarySetPublishingModeResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CallReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCallReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_CallResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryCallResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_SetMonitoringModeReq() runs on MyComp {
+    const octetstring v_msg := encodedBinarySetMonitoringModeReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_SetMonitoringModeResp() runs on MyComp {
+    const octetstring v_msg := encodedBinarySetMonitoringModeResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_ModifyMonitoredItemReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryModifyMonitoredItemReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_ModifyMonitoredItemResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryModifyMonitoredItemResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_WriteReq() runs on MyComp {
+    const octetstring v_msg := encodedBinaryWriteReq;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+  testcase tc_dec_WriteResp() runs on MyComp {
+    const octetstring v_msg := encodedBinaryWriteResp;
+    f_encDec_OpcUa_MessageChunk(v_msg);
+  }
+
+
+  testcase tc_encDec_Hello() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetHelloMessage());
+  }
+
+  testcase tc_encDec_OpenSecureChannelReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetOpenSecureChannelRequest());
+  }
+
+  testcase tc_encDec_EndpointsReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetEndpointsRequest());
+  }
+
+  testcase tc_encDec_CreateSessionReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetCreateSessionRequest());
+  }
+
+  testcase tc_encDec_ActivateSessionReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetActivateSessionRequest());
+  }
+
+  testcase tc_encDec_GetBrowseReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetBrowseRequest());
+  }
+
+  testcase tc_encDec_GetReadReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetReadRequest());
+  }
+
+  testcase tc_encDec_CreateSubscReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetCreateSubscRequest());
+  }
+
+  testcase tc_encDec_CloseSessionReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetCloseSessionRequest());
+  }
+
+  testcase tc_encDec_CloseSecureChannelReq() runs on MyComp {
+    f_encDec_OpcUa_MessageChunk(f_GetCloseSecureChannelRequest());
+  }
+
+  testcase tc_sendMessagesToServer() runs on SendReceiveComp {
+    map(mtc:testPort, system:testPort);
+    f_sendMessagesToServer();
+  }
+
+  control {
+    //Decode and test encoded messages from Wireshark
+    execute(tc_dec_Hello());
+    execute(tc_dec_Ack());
+    execute(tc_dec_Err());
+
+    execute(tc_dec_OpenSecReq());
+    execute(tc_dec_OpenSecResp());
+
+    execute(tc_dec_CloseSecReq());
+
+    execute(tc_dec_GetEndpointsReq());
+    execute(tc_dec_GetEndpointsResp());
+
+    execute(tc_dec_CreateSessionReq());
+    execute(tc_dec_CreateSessionResp());
+
+    execute(tc_dec_ActivateSessionReq());
+    execute(tc_dec_ActivateSessionResp());
+
+    execute(tc_dec_BrowseReq());
+    execute(tc_dec_BrowseResp());
+
+    execute(tc_dec_ReadReq());
+    execute(tc_dec_ReadResp());
+
+    execute(tc_dec_CreateSubscReq());
+    execute(tc_dec_CreateSubscResp());
+
+    execute(tc_dec_CreateMonitoredItemReq());
+    execute(tc_dec_CreateMonitoredItemResp());
+
+    execute(tc_dec_DeleteSubscReq());
+    execute(tc_dec_DeleteSubscResp());
+
+    execute(tc_dec_PublishReq());
+    execute(tc_dec_PublishResp());
+
+    execute(tc_dec_CloseSessionReq());
+    execute(tc_dec_CloseSessionResp());
+
+    execute(tc_dec_TranslateBrowsePathsToNodeIdsReq());
+    execute(tc_dec_TranslateBrowsePathsToNodeIdsResp());
+
+    execute(tc_dec_SetPublishingModeReq());
+    execute(tc_dec_SetPublishingModeResp());
+
+    execute(tc_dec_SetMonitoringModeReq());
+    execute(tc_dec_SetMonitoringModeResp());
+
+    execute(tc_dec_CallReq());
+    execute(tc_dec_CallResp());
+
+    execute(tc_dec_ModifyMonitoredItemReq());
+    execute(tc_dec_ModifyMonitoredItemResp());
+
+    execute(tc_dec_WriteReq());
+    execute(tc_dec_WriteResp());
+
+    //Encode and decode Messages created from TTCN structures
+    execute(tc_encDec_Hello());
+    execute(tc_encDec_OpenSecureChannelReq());
+    execute(tc_encDec_EndpointsReq());
+    execute(tc_encDec_CreateSessionReq());
+    execute(tc_encDec_ActivateSessionReq());
+    execute(tc_encDec_GetBrowseReq());
+    execute(tc_encDec_GetReadReq());
+    execute(tc_encDec_CreateSubscReq());
+    execute(tc_encDec_CloseSessionReq());
+    execute(tc_encDec_CloseSecureChannelReq());
+
+    //Encode and send TTCN messages to a local OPC server
+    execute (tc_sendMessagesToServer());
+  }
 }
\ No newline at end of file
diff --git a/test/OpcUa_Test_JSON.ttcn b/test/OpcUa_Test_JSON.ttcn
new file mode 100644
index 0000000..1ad8386
--- /dev/null
+++ b/test/OpcUa_Test_JSON.ttcn
@@ -0,0 +1,782 @@
+/////////////////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2017-2018  Ericsson AB
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// which accompanies this distribution, and is available at
+// http://www.eclipse.org/legal/epl-v10.html
+/////////////////////////////////////////////////////////////////////////////////////
+// Contributors:
+// Akos Makovics
+//
+//  File:         OpcUa_Test_JSON.ttcn
+//  Rev:          <RnXnn>
+//  Prodnr:       CNL113861
+/////////////////////////////////////////////////////////////////////////////////////
+
+module OpcUa_Test_JSON {
+
+  import from OpcUa_Types_JSON_Reversible all;
+  import from OpcUa_Functions_JSON all;
+  import from OpcUa_Templates_JSON_Reversible all;
+
+  type component MyComp {}
+
+  /////////////////////////////////////////////////////////////
+  //                                                         //
+  //             Encoders and Decoders for testing           //
+  //                   different structures                  //
+  //                                                         //
+  /////////////////////////////////////////////////////////////
+
+  external function enc_ObjectAttributes (in ObjectAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_ObjectAttributes (in octetstring p_oct, out ObjectAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_VariableAttributes (in VariableAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_VariableAttributes (in octetstring p_oct, out VariableAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_MethodAttributes (in MethodAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_MethodAttributes (in octetstring p_oct, out MethodAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_ObjectTypeAttributes (in ObjectTypeAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_ObjectTypeAttributes (in octetstring p_oct, out ObjectTypeAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_VariableTypeAttributes (in VariableTypeAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_VariableTypeAttributes (in octetstring p_oct, out VariableTypeAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_ReferenceTypeAttributes (in ReferenceTypeAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_ReferenceTypeAttributes (in octetstring p_oct, out ReferenceTypeAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_DataTypeAttributes (in DataTypeAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_DataTypeAttributes (in octetstring p_oct, out DataTypeAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_ViewAttributes (in ViewAttributes msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_ViewAttributes (in octetstring p_oct, out ViewAttributes msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_DataValue (in DataValue msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_DataValue (in octetstring p_oct, out DataValue msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_NodeId (in NodeId msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_NodeId (in octetstring p_oct, out NodeId msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  external function enc_ExpandedNodeId (in ExpandedNodeId msg) return octetstring
+    with { extension "prototype(convert) encode(JSON)" }
+
+  external function dec_ExpandedNodeId (in octetstring p_oct, out ExpandedNodeId msg) return integer
+    with {extension "prototype(backtrack) decode (JSON) errorbehavior(ALL:WARNING)"}
+
+  function f_EncDecDec_ObjectAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_VariableAttributes Enter");
+
+    var ObjectAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      eventNotifier := 0,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_ObjectAttributes_PreProcess(v_orig);
+
+    var ObjectAttributes v_dec;
+    var octetstring v_encoded := enc_ObjectAttributes(v_orig);
+
+    if (dec_ObjectAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_ObjectAttributes_PostProcess(v_dec);
+    f_ObjectAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_ObjectAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_VariableAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_VariableAttributes Enter");
+
+    var VariableAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      Value := 0,
+      dataType := omit,
+      valueRank := 0,
+      arrayDimensions := omit,
+      accessLevel := 0,
+      userAccessLevel := 0,
+      minimumSamplingInterval := omit,
+      historizing := omit,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_VariableAttributes_PreProcess(v_orig);
+
+    var VariableAttributes v_dec;
+    var octetstring v_encoded := enc_VariableAttributes(v_orig);
+
+    if (dec_VariableAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_VariableAttributes_PostProcess(v_dec);
+    f_VariableAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_VariableAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_MethodAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_MethodAttributes Enter");
+
+    var MethodAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      executable := false,
+      userExecutable := false,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_MethodAttributes_PreProcess(v_orig);
+
+    var MethodAttributes v_dec;
+    var octetstring v_encoded := enc_MethodAttributes(v_orig);
+
+    if (dec_MethodAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_MethodAttributes_PostProcess(v_dec);
+    f_MethodAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_MethodAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_ObjectTypeAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_MethodAttributes Enter");
+
+    var ObjectTypeAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      isAbstract := false,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_ObjectTypeAttributes_PreProcess(v_orig);
+
+    var ObjectTypeAttributes v_dec;
+    var octetstring v_encoded := enc_ObjectTypeAttributes(v_orig);
+
+    if (dec_ObjectTypeAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_ObjectTypeAttributes_PostProcess(v_dec);
+    f_ObjectTypeAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_ObjectTypeAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_VariableTypeAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_MethodAttributes Enter");
+
+    var VariableTypeAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      Value := 0,
+      dataType := omit,
+      valueRank := 0,
+      arrayDimensions := omit,
+      isAbstract := false,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_VariableTypeAttributes_PreProcess(v_orig);
+
+    var VariableTypeAttributes v_dec;
+    var octetstring v_encoded := enc_VariableTypeAttributes(v_orig);
+
+    if (dec_VariableTypeAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_VariableTypeAttributes_PostProcess(v_dec);
+    f_VariableTypeAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_VariableTypeAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_ReferenceTypeAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_MethodAttributes Enter");
+
+    var ReferenceTypeAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      isAbstract := true,
+      symmetric := true,
+      inverseName := omit,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_ReferenceTypeAttributes_PreProcess(v_orig);
+
+    var ReferenceTypeAttributes v_dec;
+    var octetstring v_encoded := enc_ReferenceTypeAttributes(v_orig);
+
+    if (dec_ReferenceTypeAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_ReferenceTypeAttributes_PostProcess(v_dec);
+    f_ReferenceTypeAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_ReferenceTypeAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_DataTypeAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_MethodAttributes Enter");
+
+    var DataTypeAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      isAbstract := true,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_DataTypeAttributes_PreProcess(v_orig);
+
+    var DataTypeAttributes v_dec;
+    var octetstring v_encoded := enc_DataTypeAttributes(v_orig);
+
+    if (dec_DataTypeAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_DataTypeAttributes_PostProcess(v_dec);
+    f_DataTypeAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_DataTypeAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_ViewAttributes () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_MethodAttributes Enter");
+
+    var ViewAttributes v_orig := {
+      EncodingMask := 0,
+      displayName := {
+        locale := "en",
+        text := "glish"
+      },
+      description := omit,
+      containsNoLoops := true,
+      eventNotifier := 0,
+      writeMask := 0,
+      userWriteMask := 0
+    };
+
+    f_ViewAttributes_PreProcess(v_orig);
+
+    var ViewAttributes v_dec;
+    var octetstring v_encoded := enc_ViewAttributes(v_orig);
+
+    if (dec_ViewAttributes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_ViewAttributes_PostProcess(v_dec);
+    f_ViewAttributes_PreProcess(v_dec);
+
+    if (v_encoded == enc_ViewAttributes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDecDec_DataValue () runs on MyComp {
+    log("==========================================================================");
+    log("f_EncDecDec_MethodAttributes Enter");
+
+    var DataValue v_orig := {
+      EncodingMask := 0,
+      Value := omit,
+      Status := omit,
+      SourceTimeStamp := omit,
+      SourcePicoSecond := 0,
+      ServerTimestamp := omit,
+      ServerPicoSeconds := 0
+    };
+
+    f_DataValue_PreProcess(v_orig);
+
+    var DataValue v_dec;
+    var octetstring v_encoded := enc_DataValue(v_orig);
+
+    if (dec_DataValue(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    f_DataValue_PostProcess(v_dec);
+    f_DataValue_PreProcess(v_dec);
+
+    if (v_encoded == enc_DataValue(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDec_NodeIdUInt32() {
+    log("==========================================================================");
+    log("f_EncDec_NodeIdUInt32 Enter");
+
+    var NodeId v_orig := valueof(tr_NodeId_UInt32(0, omit));
+
+    var NodeId v_dec;
+    var octetstring v_encoded := enc_NodeId(v_orig);
+
+    if (dec_NodeId(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    if (v_dec.IdType != 0) {
+      setverdict(fail, "IdType is invalid!");
+    } else {
+      v_dec.IdType := omit;
+    }
+
+    if (v_encoded == enc_NodeId(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDec_NodeIdGuid() {
+    log("==========================================================================");
+    log("f_EncDec_NodeIdGuid Enter");
+
+    var NodeId v_orig := valueof(tr_NodeId_GUID("Hello", omit));
+
+    var NodeId v_dec;
+    var octetstring v_encoded := enc_NodeId(v_orig);
+
+    if (dec_NodeId(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    if (v_encoded == enc_NodeId(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDec_ExpandedNodeIdByteString() {
+    log("==========================================================================");
+    log("f_EncDec_NodeIdGuid Enter");
+
+    var ExpandedNodeId v_orig := valueof(tr_ExpandedNodeId_ByteString("Hello", omit, omit));
+
+    var ExpandedNodeId v_dec;
+    var octetstring v_encoded := enc_ExpandedNodeId(v_orig);
+
+    if (dec_ExpandedNodeId(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    if (v_encoded == enc_ExpandedNodeId(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  function f_EncDec_MessageTypes(MessageTypes v_orig) {
+    var MessageTypes v_dec;
+    var octetstring v_encoded := enc_MessageTypes(v_orig);
+
+    if (dec_MessageTypes(v_encoded, v_dec) == -1) {
+      setverdict(fail, "Failed to decode message chunk!");
+      return;
+    }
+
+    if (v_encoded == enc_MessageTypes(v_dec)) {
+      setverdict(pass);
+    } else {
+      setverdict(fail);
+    }
+  }
+
+  testcase tc_EncDecDec_ObjectAttributes() runs on MyComp {
+    f_EncDecDec_ObjectAttributes();
+  }
+
+  testcase tc_EncDecDec_VariableAttributes() runs on MyComp {
+    f_EncDecDec_VariableAttributes();
+  }
+
+  testcase tc_EncDecDec_MethodAttributes() runs on MyComp {
+    f_EncDecDec_MethodAttributes();
+  }
+
+  testcase tc_EncDecDec_ObjectTypeAttributes() runs on MyComp {
+    f_EncDecDec_ObjectTypeAttributes();
+  }
+
+  testcase tc_EncDecDec_VariableTypeAttributes() runs on MyComp {
+    f_EncDecDec_VariableTypeAttributes();
+  }
+
+  testcase tc_EncDecDec_ReferenceTypeAttributes() runs on MyComp {
+    f_EncDecDec_ReferenceTypeAttributes();
+  }
+
+  testcase tc_EncDecDec_DataTypeAttributes() runs on MyComp {
+    f_EncDecDec_DataTypeAttributes();
+  }
+
+  testcase tc_EncDecDec_ViewAttributes() runs on MyComp {
+    f_EncDecDec_ViewAttributes();
+  }
+
+  testcase tc_EncDecDec_DataValue() runs on MyComp {
+    f_EncDecDec_DataValue();
+  }
+
+  testcase tc_EncDecDec_NodeIdUInt32() runs on MyComp {
+    f_EncDec_NodeIdUInt32();
+  }
+
+  testcase tc_EncDecDec_NodeIdGuid() runs on MyComp {
+    f_EncDec_NodeIdGuid();
+  }
+
+  testcase tc_EncDecDec_ExpandedNodeIdByteString() runs on MyComp {
+    f_EncDec_ExpandedNodeIdByteString();
+  }
+
+  testcase tc_EncDecDec_HelloMessage() runs on MyComp {
+    var MessageTypes v_orig := {
+      HelloMessage := {
+        messageType := HelloHeaderMsgType,
+        chunkType := FinalChunk,
+        messageSize := 0,
+        version := 1,
+        receiveBufferSize := 256,
+        sendBufferSize := 256,
+        maxMessageSize := 200,
+        maxChunkCount := 2,
+        endPointUrl := "EndPoint"
+      }
+    }
+
+    v_orig.HelloMessage.messageSize := f_CalculateSize(v_orig);
+
+    f_EncDec_MessageTypes(v_orig);
+  }
+
+  testcase tc_EncDecDec_AckMessage() runs on MyComp {
+    var MessageTypes v_orig := {
+      AckMessage := {
+      messageType := HelloHeaderMsgType,
+      chunkType := FinalChunk,
+      messageSize := 0,
+      version := 1,
+      receiveBufferSize := 256,
+      sendBufferSize := 256,
+      maxMessageSize := 200,
+      maxChunkCount := 2
+      }
+    }
+
+    v_orig.AckMessage.messageSize := f_CalculateSize(v_orig);
+
+    f_EncDec_MessageTypes(v_orig);
+  }
+
+  testcase tc_EncDecDec_ErrorMessage() runs on MyComp {
+    var MessageTypes v_orig := {
+      ErrorMessage := {
+      messageType := HelloHeaderMsgType,
+      chunkType := FinalChunk,
+      messageSize := 0,
+      errorCode := 1234,
+      reason := "reason"
+      }
+    }
+
+    v_orig.ErrorMessage.messageSize := f_CalculateSize(v_orig);
+
+    f_EncDec_MessageTypes(v_orig);
+  }
+
+  testcase tc_EncDecDec_ReverseHelloMessage() runs on MyComp {
+    var MessageTypes v_orig := {
+      ReverseHelloMessage := {
+      messageType := HelloHeaderMsgType,
+      chunkType := FinalChunk,
+      messageSize := 0,
+      serverUri := "Server",
+      endPointUrl := "url"
+      }
+    }
+
+    v_orig.ReverseHelloMessage.messageSize := f_CalculateSize(v_orig);
+
+    f_EncDec_MessageTypes(v_orig);
+  }
+
+  testcase tc_EncDec_OpenSecureChannelRequest() runs on MyComp {
+    var MessageTypes v_orig := {
+      OpenSecureChannelRequest := {
+        messageType := OpenSecureChannelMsgType,
+        chunkType := FinalChunk,
+        messageSize := 0,
+
+        securityChannelId := 1,
+        securePolicyUri := {2, 3, 4},
+        senderCertificate := {55, 6, 7},
+        receiverCertificateThumbprint := {0, 1},
+        sequenceHeader := {
+          SequenceNumber := 1,
+          RequestId := 0
+        },
+
+        encodingByte := 22,
+        namespaceIndex := 0,
+        nodeValue := OpenSecureChannelRequestNodeId,
+
+        requestHeader := {
+          authenticationToken := valueof(tr_NodeId_String("Id", omit)),
+          timestamp := "2018.04.13",
+          requestHandle := 2,
+          returnDiagnostics := 1,
+          auditEntryId := "tmp",
+          timeoutHint := 0,
+          additionalHeader := {
+            typeId := valueof(tr_ExpandedNodeId_GUID("AS", 0, 0)),
+            Value := 1
+          }
+        },
+        clientProtocolVersion := 1,
+        requestType := ISSUE_0,
+        securityMode := NONE_1,
+        clientNonce := "client",
+        requestedLifetime := 60
+      }
+    }
+
+    v_orig.OpenSecureChannelRequest.messageSize := f_CalculateSize(v_orig);
+
+    f_EncDec_MessageTypes(v_orig);
+  }
+
+  testcase tc_EncDec_GetEndpointsResponse() runs on MyComp {
+    var MessageTypes v_orig := {
+      GetEndpointsResponse := {
+        messageType := ServicesMsgType,
+        chunkType := FinalChunk,
+        messageSize := 0,
+
+        securityChannelId := 1,
+        securityTokenId := 2,
+        sequenceHeader := {
+          SequenceNumber := 2,
+          RequestId := 0
+        },
+
+        encodingByte := 22,
+        namespaceIndex := 0,
+        nodeValue := GetEndpointsResponseNodeId,
+
+        responseHeader := {
+          timestamp := "2018.04.13",
+          requestHandle := 3,
+          serviceResult := 1,
+          serviceDiagnostics := {
+            SymbolicId := 1,
+            NamespaceUri := 0,
+            Locale := 1,
+            LocalizedText := 22,
+            AdditionalInfo := "Hello",
+            InnerStatusCode := 1,
+            InnerDiagnosticInfo := omit
+          },
+          stringTable := {"Hello", "Bye"},
+          additionalHeader := {
+            typeId := valueof(tr_ExpandedNodeId_GUID("AS", 0, 0)),
+            Value := 1
+          }
+        },
+        Endpoints := {
+          {
+            endpointUrl := "URL",
+            server := {
+              applicationUri := "uri",
+              productUri := "product",
+              applicationName := {
+                locale := "Locale",
+                text := "Text"
+              },
+              applicationType := CLIENT_1,
+              gatewayServerUri := "gatewayServerUri",
+              discoveryProfileUri := "discoveryProfileUri",
+              discoveryUrls := {"discoveryUrls", "discoveryUrls"}
+            },
+            serverCertificate := "001010",
+            securityMode := NONE_1,
+            securityPolicyUri := "discoveryUrls",
+            userIdentityTokens := {
+              {
+                policyId := "Policy",
+                tokenType := USERNAME_1,
+                issuedTokenType := "ASD",
+                issuerEndpointUrl := "URL",
+                securityPolicyUri := "URI"
+              }
+            },
+            transportProfileUri := "URI",
+            securityLevel := 0
+          }
+        }
+      }
+    }
+
+    v_orig.GetEndpointsResponse.messageSize := f_CalculateSize(v_orig);
+
+    f_EncDec_MessageTypes(v_orig);
+  }
+
+  control {
+    //Encode and decode structures with test encoders
+    execute(tc_EncDecDec_ObjectAttributes());
+    execute(tc_EncDecDec_VariableAttributes());
+    execute(tc_EncDecDec_MethodAttributes());
+    execute(tc_EncDecDec_ObjectTypeAttributes());
+    execute(tc_EncDecDec_VariableTypeAttributes());
+    execute(tc_EncDecDec_ReferenceTypeAttributes());
+    execute(tc_EncDecDec_DataTypeAttributes());
+    execute(tc_EncDecDec_ViewAttributes());
+    execute(tc_EncDecDec_DataValue());
+    execute(tc_EncDecDec_NodeIdUInt32());
+    execute(tc_EncDecDec_NodeIdGuid());
+    execute(tc_EncDecDec_ExpandedNodeIdByteString());
+
+    //Encode and decode messages
+    execute(tc_EncDecDec_HelloMessage());
+    execute(tc_EncDecDec_AckMessage());
+    execute(tc_EncDecDec_ErrorMessage());
+    execute(tc_EncDecDec_ReverseHelloMessage());
+    execute(tc_EncDec_OpenSecureChannelRequest());
+    execute(tc_EncDec_GetEndpointsResponse());
+  }
+}  with { encode "JSON" }
\ No newline at end of file