I dig into the code and find there is occasional error in
bool XmlRpcValue::structFromXml(std::string const& valueXml, int* offset)
{
std::ofstream outfile("c:\\debug.log", std::ios::out | std::ios::app | std::ios::ate);
_type = TypeStruct;
_value.asStruct = new ValueStruct;
while (XmlRpcUtil::nextTagIs(MEMBER_TAG, valueXml, offset)) {
// name
outfile << "\noffset1 is " << *offset;
const std::string name = XmlRpcUtil::parseTag(NAME_TAG, valueXml, offset);
// value
outfile<<"\n name is" << name;
outfile << "\noffset2 is " << *offset;
XmlRpcValue val(valueXml, offset);
//for debug
outfile << "\noffset3 is " << *offset;
if ( ! val.valid()) {
invalidate();
//for debug
outfile << "\noffset4 is " << *offset;
return false;
}
const std::pair<const std::string, XmlRpcValue> p(name, val);
_value.asStruct->insert(p);
The no error log as:
offset1 is 395
name isuserDN
offset2 is 426
offset3 is 524
offset5 is 544
offset1 is 563
name isobjectClass
offset2 is 599
offset3 is 630
offset5 is 650
offset1 is 669
name isuserId
offset2 is 700
offset3 is 735
offset5 is 755
offset1 is 774
name ismodifiedTime
offset2 is 811
offset3 is 892
offset5 is 912
offset1 is 931
name ismodifier
offset2 is 964
offset3 is 1023
offset5 is 1043
offset1 is 1062
name isclassName
offset2 is 1096
offset3 is 1152
offset5 is 1172
offset1 is 1191
name iscreatedTime
offset2 is 1227
offset3 is 1308
offset5 is 1328
offset1 is 1347
name isaccountStatus
offset2 is 1385
offset3 is 1413
offset5 is 1433
offset1 is 1452
name iscreator
offset2 is 1484
offset3 is 1543
offset5 is 1563
offset1 is 1582
name isUUID
offset2 is 1611
offset3 is 1670
offset5 is 1690
offset1 is 1709
name isdescription
offset2 is 1745
offset3 is 1790
offset5 is 1810
offset1 is 1829
name isisLocked
offset2 is 1862
offset3 is 1909
offset5 is 1929
offset1 is 1948
name isname
offset2 is 1977
offset3 is 2012
offset5 is 2032
offset1 is 2051
name isID
offset2 is 2078
offset3 is 2113
offset5 is 2133
offset1 is 3974
name iscount
offset2 is 4004
offset3 is 4032
offset5 is 4052
offset1 is 4487
name isforceChangePassword
offset2 is 4534
offset3 is 4584
offset5 is 4607
offset1 is 4629
name ispolicyChecked
offset2 is 4670
offset3 is 4720
offset5 is 4743
offset1 is 4765
name isloginModuleId
offset2 is 4806
offset3 is 4860
offset5 is 4883
offset1 is 4905
name isauthenticated
offset2 is 4946
offset3 is 4996
offset5 is 5019
offset1 is 303
name isauthenticatedUser
offset2 is 342
offset3 is 2169
offset5 is 2186
offset1 is 2202
name ishashCode
offset2 is 2232
offset3 is 2276
offset5 is 2293
offset1 is 2309
name isloginMethod
offset2 is 2342
offset3 is 2377
offset5 is 2394
offset1 is 2410
name isuserIdentified
offset2 is 2446
offset3 is 2490
offset5 is 2507
offset1 is 2523
name ismessage
offset2 is 2552
offset3 is 2576
offset5 is 2593
offset1 is 2609
name isauthenticated
offset2 is 2644
offset3 is 2688
offset5 is 2705
offset1 is 2721
name issessionId
offset2 is 2752
offset3 is 3104
offset5 is 3121
offset1 is 3137
name islastAccessTime
offset2 is 3173
offset3 is 3251
offset5 is 3268
offset1 is 3284
name isclassName
offset2 is 3315
offset3 is 3371
offset5 is 3388
offset1 is 3404
name issessionOriginatedFromThisServer
offset2 is 3457
offset3 is 3501
offset5 is 3518
offset1 is 3534
name isserverId
offset2 is 3564
offset3 is 3598
offset5 is 3615
offset1 is 3631
name iscreatedTime
offset2 is 3664
offset3 is 3742
offset5 is 3759
offset1 is 3775
name isIID
offset2 is 3800
offset3 is 3856
offset5 is 3873
offset1 is 3889
name isattributes
offset2 is 3921
offset3 is 4088
offset5 is 4105
offset1 is 4121
name isserverIdInteger
offset2 is 4158
offset3 is 4192
offset5 is 4209
offset1 is 4225
name isuserUUID
offset2 is 4255
offset3 is 4311
offset5 is 4328
offset1 is 4336
name isloginModuleStates
offset2 is 4375
offset3 is 5114
offset5 is 5131
offset1 is 5147
name isrealmId
offset2 is 5176
offset3 is 5205
offset5 is 5222
offset1 is 233
name issession
offset2 is 259
offset3 is 5252
offset5 is 5266
whereas the error log is:
offset1 is 395
name isuserDN
offset2 is 426
offset3 is 524
offset5 is 544
offset1 is 563
name isobjectClass
offset2 is 599
offset3 is 630
offset5 is 650
offset1 is 669
name isuserId
offset2 is 700
offset3 is 735
offset5 is 755
offset1 is 774
name ismodifiedTime
offset2 is 811
offset3 is 892
offset5 is 912
offset1 is 931
name ismodifier
offset2 is 964
offset3 is 1023
offset5 is 1043
offset1 is 1062
name isclassName
offset2 is 1096
offset3 is 1152
offset5 is 1172
offset1 is 1191
name iscreatedTime
offset2 is 1227
offset3 is 1308
offset5 is 1328
offset1 is 1347
name isaccountStatus
offset2 is 1385
offset3 is 1413
offset5 is 1433
offset1 is 1452
name is
offset2 is 1452
offset3 is 1452
offset4 is 1452
offset1 is 303
name isauthenticatedUser
offset2 is 342
offset3 is 342
offset4 is 342
offset1 is 233
name issession
offset2 is 259
offset3 is 259
offset4 is 259
I struggle with the problem all the afternoon but have no idea. It seems the problem happens during reading the response. Is the response stream not received correctly or something else? Please advise. Thanks a lot.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, all
There is some occasional error in parseResponse() function.
Here is the xml content:
- <methodResponse>
- <params>
- <param>
- <value>
- <struct>
- <member>
<name>session</name>
- <value>
- <struct>
- <member>
<name>authenticatedUser</name>
- <value>
- <struct>
- <member>
<name>userDN</name>
<value>CN=Test Proxy, OU=Security, O=i-sprint, L=Singapore, ST=Singapore, C=SG</value>
</member>
- <member>
<name>objectClass</name>
<value>User</value>
</member>
- <member>
<name>userId</name>
<value>usoagent</value>
</member>
- <member>
<name>modifiedTime</name>
- <value>
<dateTime.iso8601>20080604T18:53:43</dateTime.iso8601>
</value>
</member>
- <member>
<name>modifier</name>
<value>C0A8012A7B230118EF4D3710CC29B534</value>
</member>
- <member>
<name>className</name>
<value>com.isprint.am.core.impl.User</value>
</member>
- <member>
<name>createdTime</name>
- <value>
<dateTime.iso8601>20080423T20:09:13</dateTime.iso8601>
</value>
</member>
- <member>
<name>accountStatus</name>
<value>A</value>
</member>
- <member>
<name>creator</name>
<value>C0A8012A7B230118EF4D3710CC29B534</value>
</member>
- <member>
<name>UUID</name>
<value>C0A8012AE6E3011979788A9FB47875AD</value>
</member>
- <member>
<name>description</name>
<value>ESSO Agent Account</value>
</member>
- <member>
<name>isLocked</name>
- <value>
<boolean>0</boolean>
</value>
</member>
- <member>
<name>name</name>
<value>usoagent</value>
</member>
- <member>
<name>ID</name>
<value>usoagent</value>
</member>
</struct>
</value>
</member>
- <member>
<name>hashCode</name>
- <value>
<i4>-1356954097</i4>
</value>
</member>
- <member>
<name>loginMethod</name>
<value>Certificate</value>
</member>
- <member>
<name>userIdentified</name>
- <value>
<boolean>1</boolean>
</value>
</member>
- <member>
<name>message</name>
<value />
</member>
- <member>
<name>authenticated</name>
- <value>
<boolean>1</boolean>
</value>
</member>
- <member>
<name>sessionId</name>
<value>5101000131C76E140423230807074C9B43FC4C565A0E40922E48E9F1CB69B05FD65A3736ECA2D42453BFAC6E4668F8886AE164862DAE8B39B079C828164B0AECC93074B15F1FEB0A4AB6B9A09FD3C1E3EBD06B6F906C49014291195344FBAFB2A7CDB184420180E8DDF6C5AA1C889177CBE5496A7A388D8C452ACE7E4440FC5554D4EE0326042A2F1D92EB51039B97845B077FE49BC3A49DC789A365A3377D2565FCB100</value>
</member>
- <member>
<name>lastAccessTime</name>
- <value>
<dateTime.iso8601>20080604T18:53:43</dateTime.iso8601>
</value>
</member>
- <member>
<name>className</name>
<value>com.isprint.am.core.auth.Session</value>
</member>
- <member>
<name>sessionOriginatedFromThisServer</name>
- <value>
<boolean>1</boolean>
</value>
</member>
- <member>
<name>serverId</name>
<value>Danielyeo2</value>
</member>
- <member>
<name>createdTime</name>
- <value>
<dateTime.iso8601>20080604T18:53:42</dateTime.iso8601>
</value>
</member>
- <member>
<name>IID</name>
<value>C0A8012A036F011A5335F6475E7AFBC1</value>
</member>
- <member>
<name>attributes</name>
- <value>
- <struct>
- <member>
<name>count</name>
<value>1</value>
</member>
</struct>
</value>
</member>
- <member>
<name>serverIdInteger</name>
- <value>
<i4>1</i4>
</value>
</member>
- <member>
<name>userUUID</name>
<value>C0A8012AE6E3011979788A9FB47875AD</value>
</member>
- <member>
<name>loginModuleStates</name>
- <value>
- <array>
- <data>
- <value>
- <struct>
- <member>
<name>forceChangePassword</name>
- <value>
<boolean>0</boolean>
</value>
</member>
- <member>
<name>policyChecked</name>
- <value>
<boolean>1</boolean>
</value>
</member>
- <member>
<name>loginModuleId</name>
<value>ClientCertificateOverSSL</value>
</member>
- <member>
<name>authenticated</name>
- <value>
<boolean>1</boolean>
</value>
</member>
</struct>
</value>
</data>
</array>
</value>
</member>
- <member>
<name>realmId</name>
<value>40153</value>
</member>
</struct>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
(sorry for no use html tag since i don't know it.)
I dig into the code and find there is occasional error in
bool XmlRpcValue::structFromXml(std::string const& valueXml, int* offset)
{
std::ofstream outfile("c:\\debug.log", std::ios::out | std::ios::app | std::ios::ate);
_type = TypeStruct;
_value.asStruct = new ValueStruct;
while (XmlRpcUtil::nextTagIs(MEMBER_TAG, valueXml, offset)) {
// name
outfile << "\noffset1 is " << *offset;
const std::string name = XmlRpcUtil::parseTag(NAME_TAG, valueXml, offset);
// value
outfile<<"\n name is" << name;
outfile << "\noffset2 is " << *offset;
XmlRpcValue val(valueXml, offset);
//for debug
outfile << "\noffset3 is " << *offset;
if ( ! val.valid()) {
invalidate();
//for debug
outfile << "\noffset4 is " << *offset;
return false;
}
const std::pair<const std::string, XmlRpcValue> p(name, val);
_value.asStruct->insert(p);
(void) XmlRpcUtil::nextTagIs(MEMBER_ETAG, valueXml, offset);
//for debug
outfile << "\noffset5 is " << *offset;
}
return true;
}
The no error log as:
offset1 is 395
name isuserDN
offset2 is 426
offset3 is 524
offset5 is 544
offset1 is 563
name isobjectClass
offset2 is 599
offset3 is 630
offset5 is 650
offset1 is 669
name isuserId
offset2 is 700
offset3 is 735
offset5 is 755
offset1 is 774
name ismodifiedTime
offset2 is 811
offset3 is 892
offset5 is 912
offset1 is 931
name ismodifier
offset2 is 964
offset3 is 1023
offset5 is 1043
offset1 is 1062
name isclassName
offset2 is 1096
offset3 is 1152
offset5 is 1172
offset1 is 1191
name iscreatedTime
offset2 is 1227
offset3 is 1308
offset5 is 1328
offset1 is 1347
name isaccountStatus
offset2 is 1385
offset3 is 1413
offset5 is 1433
offset1 is 1452
name iscreator
offset2 is 1484
offset3 is 1543
offset5 is 1563
offset1 is 1582
name isUUID
offset2 is 1611
offset3 is 1670
offset5 is 1690
offset1 is 1709
name isdescription
offset2 is 1745
offset3 is 1790
offset5 is 1810
offset1 is 1829
name isisLocked
offset2 is 1862
offset3 is 1909
offset5 is 1929
offset1 is 1948
name isname
offset2 is 1977
offset3 is 2012
offset5 is 2032
offset1 is 2051
name isID
offset2 is 2078
offset3 is 2113
offset5 is 2133
offset1 is 3974
name iscount
offset2 is 4004
offset3 is 4032
offset5 is 4052
offset1 is 4487
name isforceChangePassword
offset2 is 4534
offset3 is 4584
offset5 is 4607
offset1 is 4629
name ispolicyChecked
offset2 is 4670
offset3 is 4720
offset5 is 4743
offset1 is 4765
name isloginModuleId
offset2 is 4806
offset3 is 4860
offset5 is 4883
offset1 is 4905
name isauthenticated
offset2 is 4946
offset3 is 4996
offset5 is 5019
offset1 is 303
name isauthenticatedUser
offset2 is 342
offset3 is 2169
offset5 is 2186
offset1 is 2202
name ishashCode
offset2 is 2232
offset3 is 2276
offset5 is 2293
offset1 is 2309
name isloginMethod
offset2 is 2342
offset3 is 2377
offset5 is 2394
offset1 is 2410
name isuserIdentified
offset2 is 2446
offset3 is 2490
offset5 is 2507
offset1 is 2523
name ismessage
offset2 is 2552
offset3 is 2576
offset5 is 2593
offset1 is 2609
name isauthenticated
offset2 is 2644
offset3 is 2688
offset5 is 2705
offset1 is 2721
name issessionId
offset2 is 2752
offset3 is 3104
offset5 is 3121
offset1 is 3137
name islastAccessTime
offset2 is 3173
offset3 is 3251
offset5 is 3268
offset1 is 3284
name isclassName
offset2 is 3315
offset3 is 3371
offset5 is 3388
offset1 is 3404
name issessionOriginatedFromThisServer
offset2 is 3457
offset3 is 3501
offset5 is 3518
offset1 is 3534
name isserverId
offset2 is 3564
offset3 is 3598
offset5 is 3615
offset1 is 3631
name iscreatedTime
offset2 is 3664
offset3 is 3742
offset5 is 3759
offset1 is 3775
name isIID
offset2 is 3800
offset3 is 3856
offset5 is 3873
offset1 is 3889
name isattributes
offset2 is 3921
offset3 is 4088
offset5 is 4105
offset1 is 4121
name isserverIdInteger
offset2 is 4158
offset3 is 4192
offset5 is 4209
offset1 is 4225
name isuserUUID
offset2 is 4255
offset3 is 4311
offset5 is 4328
offset1 is 4336
name isloginModuleStates
offset2 is 4375
offset3 is 5114
offset5 is 5131
offset1 is 5147
name isrealmId
offset2 is 5176
offset3 is 5205
offset5 is 5222
offset1 is 233
name issession
offset2 is 259
offset3 is 5252
offset5 is 5266
whereas the error log is:
offset1 is 395
name isuserDN
offset2 is 426
offset3 is 524
offset5 is 544
offset1 is 563
name isobjectClass
offset2 is 599
offset3 is 630
offset5 is 650
offset1 is 669
name isuserId
offset2 is 700
offset3 is 735
offset5 is 755
offset1 is 774
name ismodifiedTime
offset2 is 811
offset3 is 892
offset5 is 912
offset1 is 931
name ismodifier
offset2 is 964
offset3 is 1023
offset5 is 1043
offset1 is 1062
name isclassName
offset2 is 1096
offset3 is 1152
offset5 is 1172
offset1 is 1191
name iscreatedTime
offset2 is 1227
offset3 is 1308
offset5 is 1328
offset1 is 1347
name isaccountStatus
offset2 is 1385
offset3 is 1413
offset5 is 1433
offset1 is 1452
name is
offset2 is 1452
offset3 is 1452
offset4 is 1452
offset1 is 303
name isauthenticatedUser
offset2 is 342
offset3 is 342
offset4 is 342
offset1 is 233
name issession
offset2 is 259
offset3 is 259
offset4 is 259
I struggle with the problem all the afternoon but have no idea. It seems the problem happens during reading the response. Is the response stream not received correctly or something else? Please advise. Thanks a lot.