每当我尝试将ActivateSessionRequest发送到opcua服务器时,都会引发错误,指出“ BadSessionNotActivated ”。下面是ActivateSessionRequest的消息格式:
var ActivateSessionRequest v_activateSessionReq := {
requestHeader := session_reqHeader,
clientSignature := {
algorithm := valueof(tr_String("http://opcfoundation.org/UA/SecurityPolicy#None")),
Signature := valueof(tr_ByteString({48, 130, 4, 19, 48, 130, 2, 251, 160, 3, 2, 1, 2, 2, 2, 16, 26, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 40, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 18, 48, 16, 6, 3, 85, 4, 3, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 48, 34, 24, 15, 50, 48, 49, 56, 48, 50, 48, 53, 49, 51, 53, 54, 48, 50, 90, 24, 15, 50, 48, 49, 57, 48, 50, 48, 53, 49, 51, 53, 54, 48, 50, 90, 48, 40, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 18, 48, 16, 6, 3, 85, 4, 3, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 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, 178, 243, 137, 233, 196, 81, 105, 65, 195, 121, 2, 212, 193, 216, 187, 73, 213, 135, 135, 163, 140, 13, 165, 74, 203, 63, 212, 221, 158, 178, 59, 89, 71, 118, 141, 147, 102, 111, 5, 111, 52, 36, 160, 187, 189, 244, 38, 0, 200, 206, 33, 174, 227, 110, 132, 79, 202, 59, 223, 29, 116, 217, 12, 193, 191, 44, 87, 168, 113, 69, 125, 23, 239, 71, 139, 38, 121, 203, 255, 54, 196, 68, 199, 249, 43, 206, 32, 255, 192, 10, 134, 200, 71, 104, 150, 176, 66, 233, 241, 17, 227, 3, 96, 172, 169, 164, 96, 113, 114, 190, 194, 28, 232, 161, 46, 241, 170, 0, 70, 215, 89, 228, 130, 219, 152, 216, 85, 234, 72, 142, 103, 63, 211, 101, 238, 224, 160, 84, 134, 171, 241, 148, 60, 212, 190, 250, 16, 203, 248, 212, 153, 16, 56, 159, 153, 185, 202, 239, 135, 150, 185, 188, 80, 207, 62, 122, 172, 25, 110, 80, 124, 166, 227, 86, 32, 97, 137, 35, 164, 156, 1, 150, 51, 64, 140, 180, 196, 162, 32, 131, 207, 170, 144, 19, 90, 251, 239, 173, 33, 65, 135, 125, 110, 137, 2, 184, 106, 146, 55, 166, 217, 141, 127, 163, 137, 57, 91, 158, 133, 29, 218, 205, 174, 98, 208, 123, 30, 240, 42, 29, 102, 187, 113, 26, 166, 30, 55, 207, 49, 32, 132, 173, 115, 155, 7, 207, 206, 201, 27, 209, 52, 198, 119, 210, 142, 161, 2, 3, 1, 0, 1, 163, 130, 1, 65, 48, 130, 1, 61, 48, 12, 6, 3, 85, 29, 19, 1, 1, 255, 4, 2, 48, 0, 48, 29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 162, 197, 27, 92, 111, 157, 37, 181, 146, 213, 162, 250, 174, 112, 194, 229, 164, 3, 176, 205, 48, 81, 6, 3, 85, 29, 35, 4, 74, 48, 72, 128, 20, 162, 197, 27, 92, 111, 157, 37, 181, 146, 213, 162, 250, 174, 112, 194, 229, 164, 3, 176, 205, 161, 44, 164, 42, 48, 40, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 18, 48, 16, 6, 3, 85, 4, 3, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 130, 2, 16, 26, 48, 91, 6, 3, 85, 29, 17, 4, 84, 48, 82, 134, 44, 117, 114, 110, 58, 97, 118, 100, 111, 111, 116, 99, 104, 97, 108, 107, 101, 45, 86, 105, 114, 116, 117, 97, 108, 66, 111, 120, 58, 78, 111, 100, 101, 79, 80, 67, 85, 65, 45, 83, 101, 114, 118, 101, 114, 130, 9, 108, 111, 99, 97, 108, 104, 111, 115, 116, 130, 23, 97, 118, 100, 111, 111, 116, 99, 104, 97, 108, 107, 101, 45, 86, 105, 114, 116, 117, 97, 108, 66, 111, 120, 48, 44, 6, 9, 96, 134, 72, 1, 134, 248, 66, 1, 13, 4, 31, 22, 29, 79, 112, 101, 110, 83, 83, 76, 32, 71, 101, 110, 101, 114, 97, 116, 101, 100, 32, 67, 101, 114, 116, 105, 102, 105, 99, 97, 116, 101, 48, 14, 6, 3, 85, 29, 15, 1, 1, 255, 4, 4, 3, 2, 2, 252, 48, 32, 6, 3, 85, 29, 37, 1, 1, 255, 4, 22, 48, 20, 6, 8, 43, 6, 1, 5, 5, 7, 3, 1, 6, 8, 43, 6, 1, 5, 5, 7, 3, 2, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 3, 130, 1, 1, 0, 147, 168, 16, 170, 204, 221, 81, 100, 167, 38, 104, 142, 27, 107, 108, 87, 94, 195, 100, 124, 141, 117, 46, 23, 231, 145, 68, 182, 241, 225, 148, 94, 144, 1, 142, 61, 228, 88, 64, 243, 126, 180, 17, 33, 164, 128, 234, 183, 198, 31, 223, 59, 125, 218, 110, 0, 112, 182, 244, 199, 220, 139, 114, 162, 153, 76, 245, 134, 167, 163, 199, 175, 153, 82, 214, 106, 142, 15, 52, 87, 11, 230, 95, 75, 23, 170, 137, 92, 144, 76, 111, 179, 1, 36, 150, 191, 84, 226, 252, 199, 228, 38, 97, 138, 26, 32, 230, 65, 110, 154, 179, 104, 146, 186, 104, 248, 246, 26, 136, 12, 15, 220, 6, 203, 220, 141, 230, 11, 185, 247, 250, 9, 76, 236, 74, 101, 149, 32, 100, 220, 249, 46, 255, 129, 21, 126, 6, 86, 230, 198, 94, 228, 51, 50, 73, 103, 57, 212, 105, 255, 9, 181, 189, 104, 121, 27, 21, 78, 196, 226, 99, 176, 44, 194, 176, 211, 216, 13, 81, 142, 35, 52, 76, 116, 49, 190, 253, 199, 166, 51, 41, 105, 81, 90, 222, 232, 223, 74, 100, 203, 192, 130, 48, 46, 116, 37, 236, 199, 70, 81, 60, 244, 6, 45, 51, 246, 4, 254, 178, 240, 14, 22, 64, 200, 134, 199, 249, 171, 118, 219, 81, 124, 218, 91, 175, 65, 59, 233, 19, 110, 217, 72, 165, 91, 75, 182, 12, 214, 215, 30, 169, 153, 36, 7, 69, 60 ,224, 153, 75, 106, 120, 118, 227, 63, 4, 63, 14, 101, 116, 161, 229, 230, 127, 196, 14, 37, 23, 251, 174, 94, 204, 114, 180, 26, 77, 200, 61, 148}))
},
clientSoftwareCertificates := { realArray := { arrayLength := 0, arrayValues := { } } },
localeIds := valueof(tr_ListOfLocaleId({})),
userIdentityToken := {
encodingByte := 1,
twoByteNodeValue := omit,
namespaceIndex := 0,
fourByteNodeValue := 321,
encoding := 1,
parameterLength := 13,
extensibleParameterBody := {
anonymousIdentityToken := {
policyId := valueof(tr_String( "username_basic256"))
}
}
},
userTokenSignature := {
algorithm := valueof(tr_StringNull),
Signature := valueof(tr_ByteStringNull)
}
}
Client-Server Communication 如图所示,ActivateSessionRequest通过将SessionId和AuthenticationToken发送到服务器而成功完成。 ActivateSessionRequest的头包含AuthenticationToken。但是,如何向服务器提供SessionId?是因为我没有在ActivateSessionRequest中提供SessionId导致服务器抛出错误还是由于其他错误?有人可以指导我吗?
任何反馈都非常感谢。预先谢谢你
谨此问候
Avdoot