|
<syncml>
<synchdr>
<verdtd>
1.2
<verproto>
SyncML/1.2
<sessionid>
14
<msgid>
8
<target>
<locuri>
IMEI:359148111923117
<locuri>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
<respuri>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
<syncbody>
<status>
<cmdid>
1
<msgref>
8
<cmdref>
0
<cmd>
SyncHdr
<targetref>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
<sourceref>
IMEI:359148111923117
200
<status>
<cmdid>
2
<msgref>
8
<cmdref>
111
<cmd>
Sync
<targetref>
card
<sourceref>
Contacts
200
<status>
<cmdid>
3
<msgref>
8
<cmdref>
112
<cmd>
Replace
<sourceref>
29
201
<status>
<cmdid>
4
<msgref>
8
<cmdref>
113
<cmd>
Replace
<sourceref>
43
201
<status>
<cmdid>
5
<msgref>
8
<cmdref>
114
<cmd>
Replace
<sourceref>
106
201
<status>
<cmdid>
6
<msgref>
8
<cmdref>
115
<cmd>
Replace
<sourceref>
41
201
<status>
<cmdid>
7
<msgref>
8
<cmdref>
116
<cmd>
Replace
<sourceref>
42
201
<status>
<cmdid>
8
<msgref>
8
<cmdref>
117
<cmd>
Replace
<sourceref>
151
201
<status>
<cmdid>
9
<msgref>
8
<cmdref>
118
<cmd>
Replace
<sourceref>
141
201
<status>
<cmdid>
10
<msgref>
8
<cmdref>
119
<cmd>
Replace
<sourceref>
114
201
<status>
<cmdid>
11
<msgref>
8
<cmdref>
120
<cmd>
Replace
<sourceref>
40
201
<status>
<cmdid>
12
<msgref>
8
<cmdref>
121
<cmd>
Replace
<sourceref>
81
201
<status>
<cmdid>
13
<msgref>
8
<cmdref>
122
<cmd>
Replace
<sourceref>
30
201
<status>
<cmdid>
14
<msgref>
8
<cmdref>
123
<cmd>
Replace
<sourceref>
163
201
<status>
<cmdid>
15
<msgref>
8
<cmdref>
124
<cmd>
Replace
<sourceref>
113
201
<status>
<cmdid>
16
<msgref>
8
<cmdref>
125
<cmd>
Replace
<sourceref>
116
201
<status>
<cmdid>
17
<msgref>
8
<cmdref>
126
<cmd>
Replace
<sourceref>
169
201
<status>
<cmdid>
18
<msgref>
8
<cmdref>
127
<cmd>
Replace
<sourceref>
168
201
<status>
<cmdid>
19
<msgref>
8
<cmdref>
128
<cmd>
Replace
<sourceref>
80
201
<status>
<cmdid>
20
<msgref>
8
<cmdref>
129
<cmd>
Replace
<sourceref>
65
201
<status>
<cmdid>
21
<msgref>
8
<cmdref>
130
<cmd>
Replace
<sourceref>
101
213
IMEI of phone and URI's is changed, but it does'nt matter here. This SyncML is generated by your project from *.wbxml generated by Funambol (open source Java sync project).
|
|
|
|
|
What is the "original" syncml doc?. i.e. like below,
<syncml xmlns="’SYNCML:SYNCML1.2’">
<synchdr>
<verdtd>1.2
<verproto>SyncML/1.2
<sessionid>1
<msgid>1
<target><locuri>IMEI:001004FF1234567
<locuri>http://www.datasync.org/servlet/syncit
<cred>
<type xmlns="’syncml:metinf’">syncml:auth-md5
<format xmlns="’syncml:metinf’">b64
Zz6EivR3yeaaENcRN6lpAQ==
<syncbody>
<get>
<cmdid>1234
<item>
<target><locuri>./devinf12
<replace>
<cmdid>1234
<cred>
<type xmlns="syncml:metinf">syncml:auth-md5
<format xmlns="syncml:metinf">b64
Zz6EivR3yeaaENcRN6lpAQ==
<type xmlns="syncml:metinf">text/calendar
<item>
<locuri>./20
|
|
|
|
|
Sorry, but i don't understand what you think when writing: "original". First one in sequence of synchronisation messages?
|
|
|
|
|
Sory about last message. This is the correct one:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-SyncML-RepPro-DTD-V1_1_2-20030505-D.dtd">
<SyncML>
<SyncHdr>
<VerDTD>
1.2
</VerDTD>
<VerProto>
SyncML/1.2
</VerProto>
<SessionID>
14
</SessionID>
<MsgID>
8
</MsgID>
<Target>
<LocURI>
IMEI:359148111023117
</LocURI>
</Target>
<Source>
<LocURI>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</LocURI>
</Source>
<RespURI>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</RespURI>
</SyncHdr>
<SyncBody>
<Status>
<CmdID>
1
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
0
</CmdRef>
<Cmd>
SyncHdr
</Cmd>
<TargetRef>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</TargetRef>
<SourceRef>
IMEI:359148111023117
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
2
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
111
</CmdRef>
<Cmd>
Sync
</Cmd>
<TargetRef>
card
</TargetRef>
<SourceRef>
Contacts
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
3
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
112
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
29
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
4
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
113
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
43
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
5
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
114
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
106
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
6
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
115
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
41
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
7
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
116
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
42
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
8
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
117
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
151
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
9
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
118
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
141
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
10
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
119
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
114
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
11
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
120
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
40
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
12
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
121
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
81
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
13
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
122
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
30
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
14
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
123
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
163
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
15
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
124
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
113
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
16
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
125
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
116
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
17
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
126
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
169
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
18
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
127
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
168
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
19
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
128
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
80
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
20
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
129
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
65
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
21
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
130
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
101
</SourceRef>
<Data>
213
</Data>
</Status>
</SyncBody>
</SyncML>
IMEI of phone and URI's is changed, but it does'nt matter here. This SyncML is generated by your project from *.wbxml generated by Funambol (open source Java sync project).
|
|
|
|
|
Hi,
I put the xml in the encoded/decoder several times and got back the original. The indentation is not identical but the actual content is. Is this the problem?
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-SyncML-RepPro-DTD-V1_1_2-20030505-D.dtd">
<SyncML>
<SyncHdr>
<VerDTD>
1.2
</VerDTD>
<VerProto>
SyncML/1.2
</VerProto>
<SessionID>
14
</SessionID>
<MsgID>
8
</MsgID>
<Target>
<LocURI>
IMEI:359148111023117
</LocURI>
</Target>
<Source>
<LocURI>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</LocURI>
</Source>
<RespURI>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</RespURI>
</SyncHdr>
<SyncBody>
<Status>
<CmdID>
1
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
0
</CmdRef>
<Cmd>
SyncHdr
</Cmd>
<TargetRef>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</TargetRef>
<SourceRef>
IMEI:359148111023117
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
2
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
111
</CmdRef>
<Cmd>
Sync
</Cmd>
<TargetRef>
card
</TargetRef>
<SourceRef>
Contacts
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
3
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
112
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
29
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
4
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
113
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
43
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
5
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
114
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
106
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
6
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
115
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
41
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
7
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
116
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
42
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
8
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
117
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
151
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
9
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
118
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
141
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
10
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
119
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
114
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
11
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
120
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
40
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
12
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
121
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
81
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
13
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
122
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
30
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
14
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
123
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
163
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
15
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
124
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
113
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
16
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
125
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
116
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
17
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
126
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
169
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
18
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
127
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
168
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
19
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
128
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
80
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
20
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
129
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
65
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
21
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
130
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
101
</SourceRef>
<Data>
213
</Data>
</Status>
</SyncBody>
</SyncML>
|
|
|
|
|
No it isn't problem. Maybe i have some problems with charsets? I got something like this when encode/decode several times (i run program in debug mode):
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-SyncML-RepPro-DTD-V1_1_2-20030505-D.dtd">
<SyncML>
<SyncHdr>
<VerDTD>
</>
<Atomic/>
<Replace/>
<Replace/>
<Replace/>
<VerDTD/>
<Target/>
<VerProto/>
<Replace/>
<Replace/>
</VerDTD>
<VerProto>
</>
<Data/>
<Replace/>
<Replace/>
<Replace/>
<Get>
<SourceParent>
<Target>
<Search>
<Copy>
<CmdRef>
<TargetRef/>
<VerDTD/>
<Target/>
<VerProto/>
<Replace/>
<Replace/>
</CmdRef>
<SessionID>
</>
<Archive/>
<Replace/>
<Replace/>
<Replace/>
<VerDTD/>
<MoreData/>
<Replace/>
<Replace/>
</SessionID>
<MsgID>
</>
<Alert/>
<Replace/>
<Replace/>
<Replace/>
<FilterType/>
<Replace/>
<Replace/>
</MsgID>
<Target>
<LocURI>
</>
<MsgID/>
<Replace/>
<Replace/>
<Replace/>
<Replace/>
<Chal>
<Copy>
<Add>
<Chal>
<TargetParent/>
<NumberOfChanges/>
<Field/>
<SourceParent/>
<VerDTD/>
<MoreData/>
<FilterType/>
</>
</>
</>
<SourceParent/>
<VerProto/>
<NumberOfChanges/>
</>
</>
<Record/>
<Replace/>
<Replace/>
<Replace/>
</Chal>
</Add>
<Source>
<LocURI>
</>
<MapItem>
<Replace/>
<Replace/>
<Replace/>
<Replace/>
<SourceRef>
<MoreData>
<MoreData>
<>
<TargetParent/>
<TargetRef/>
<TargetRef/>
<FilterType/>
</>
<Target/>
<VerProto/>
<NumberOfChanges/>
<NumberOfChanges/>
<Target/>
<VerDTD/>
<Filter/>
<Record/>
<Target/>
<VerDTD/>
<VerDTD/>
<NumberOfChanges/>
<TargetParent/>
<NumberOfChanges/>
<NumberOfChanges/>
<SourceParent/>
</>
<TargetRef/>
<SftDel>
<Field>
<Target>
<RespURI>
<SyncML>
<Results>
<TargetRef>
<SyncHdr>
<TargetRef/>
<Sequence>
<NumberOfChanges>
<Move/>
<Sync>
<NumberOfChanges>
<SessionID>
<NumberOfChanges>
<NumberOfChanges>
<Status>
<TargetRef>
<Target>
<Status>
<Sequence>
</>
<Alert>
</>
<VerProto/>
<>
<SourceParent/>
<MoreData/>
<VerProto/>
<SourceParent/>
<>
<Alert>
<Alert>
<Alert>
<Record/>
<NumberOfChanges/>
<VerProto/>
<Filter/>
<>
<FilterType/>
$(46791356E175 ""a?W http://80.233.167.113:3390/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175 ""kiK? 1 "\? 8 "L? 0 "J? SyncHdr "o?Y http://80.233.167.113:3390/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175 "h? IMEI:359148000923007 "O?
200 ""iK? 2 "\? 8 "L?
111 "J? Sync "o? card "h? Contacts "O?
200 ""iK? 3 "\? 8 "L?
112 "J? Replace "h? 29 "O?
201 ""iK? 4 "\? 8 "L?
113 "J? Replace "h? 43 "O?
201 ""iK? 5 "\? 8 "L?
114 "J? Replace "h?
106 "O?
201 ""iK? 6 "\? 8 "L?
115 "J? Replace "h? 41 "O?
201 ""iK? 7 "\? 8 "L?
116 "J? Replace "h? 42 "O?
201 ""iK? 8 "\? 8 "L?
117 "J? Replace "h?
151 "O?
201 ""iK? 9 "\? 8 "L?
118 "J? Replace "h?
141 "O?
201 ""iK? 10 "\? 8 "L?
119 "J? Replace "h?
114 "O?
201 ""iK? 11 "\? 8 "L?
120 "J? Replace "h? 40 "O?
201 ""iK? 12 "\? 8 "L?
121 "J? Replace "h? 81 "O?
201 ""iK? 13 "\? 8 "L?
122 "J? Replace "h? 30 "O?
201 ""iK? 14 "\? 8 "L?
123 "J? Replace "h?
163 "O?
201 ""iK? 15 "\? 8 "L?
124 "J? Replace "h?
113 "O?
201 ""iK? 16 "\? 8 "L?
125 "J? Replace "h?
116 "O?
201 ""iK? 17 "\? 8 "L?
126 "J? Replace "h?
169 "O?
201 ""iK? 18 "\? 8 "L?
127 "J? Replace "h?
168 "O?
201 ""iK? 19 "\? 8 "L?
128 "J? Replace "h? 80 "O?
201 ""iK? 20 "\? 8 "L?
129 "J? Replace "h? 65 "O?
201 ""iK? 21 "\? 8 "L?
130 "J? Replace "h?
101 "O?
213 """")
</>
</Alert>
</Alert>
</Alert>
</>
</>
</Alert>
</Sequence>
</Status>
</Target>
</TargetRef>
</Status>
</NumberOfChanges>
</NumberOfChanges>
</SessionID>
</NumberOfChanges>
</Sync>
</NumberOfChanges>
</Sequence>
</SyncHdr>
</TargetRef>
</Results>
</SyncML>
</RespURI>
</Target>
</Field>
</SftDel>
</>
</MoreData>
</MoreData>
</SourceRef>
</MapItem>
</LocURI>
</Source>
</Copy>
</Chal>
</LocURI>
</Target>
</Copy>
</Search>
</Target>
</SourceParent>
</Get>
</VerProto>
</SyncHdr>
</SyncML>
|
|
|
|
|
One thing I noticed about the original xml document is that it used "spaces" instead of tabs to make it readable. There are special considerations for whitespace in xml documents (<a href="http://www.oracle.com/technology/pub/articles/wang-whitespace.html">http://www.oracle.com/technology/pub/articles/wang-whitespace.html</a>[<a href="http://www.oracle.com/technology/pub/articles/wang-whitespace.html" target="_blank" title="New Window">^</a>]). This is what was causing the incorrect indentation.
I added the following three lines of code to the end of the ML_Parse sub in the ML_Parser_Class to clean up the whitespaces.
For x As Integer = 0 To Me.ML_Page_Array_Count
ML_Page_Array(x).ML_Value = Trim(ML_Page_Array(x).ML_Value)
Next
Now is the output is identical to the input:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-SyncML-RepPro-DTD-V1_1_2-20030505-D.dtd">
<SyncML>
<SyncHdr>
<VerDTD>
1.2
</VerDTD>
<VerProto>
SyncML/1.2
</VerProto>
<SessionID>
14
</SessionID>
<MsgID>
8
</MsgID>
<Target>
<LocURI>
IMEI:359148111023117
</LocURI>
</Target>
<Source>
<LocURI>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</LocURI>
</Source>
<RespURI>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</RespURI>
</SyncHdr>
<SyncBody>
<Status>
<CmdID>
1
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
0
</CmdRef>
<Cmd>
SyncHdr
</Cmd>
<TargetRef>
http://mydomain/funambol/ds;jsessionid=F02C9429DBFFF7326C8B46791356E175
</TargetRef>
<SourceRef>
IMEI:359148111023117
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
2
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
111
</CmdRef>
<Cmd>
Sync
</Cmd>
<TargetRef>
card
</TargetRef>
<SourceRef>
Contacts
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
3
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
112
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
29
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
4
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
113
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
43
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
5
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
114
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
106
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
6
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
115
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
41
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
7
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
116
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
42
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
8
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
117
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
151
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
9
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
118
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
141
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
10
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
119
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
114
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
11
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
120
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
40
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
12
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
121
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
81
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
13
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
122
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
30
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
14
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
123
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
163
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
15
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
124
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
113
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
16
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
125
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
116
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
17
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
126
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
169
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
18
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
127
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
168
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
19
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
128
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
80
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
20
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
129
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
65
</SourceRef>
<Data>
201
</Data>
</Status>
<Status>
<CmdID>
21
</CmdID>
<MsgRef>
8
</MsgRef>
<CmdRef>
130
</CmdRef>
<Cmd>
Replace
</Cmd>
<SourceRef>
101
</SourceRef>
<Data>
213
</Data>
</Status>
</SyncBody>
</SyncML>
This is the code which is decoding and encoding the page several times.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim FileContents As String
Dim Page As String = ""
Dim Content_Type As String = ""
Dim Encoder As New WBXML_Coder_Class
Dim Decoder As New WBXML_Coder_Class
Dim start As Integer = My.Computer.Clock.TickCount
Dim FileName As String = directory & "syncml\error.txt" '"nokia prov p34.txt" '"test.wml.txt"
If My.Computer.FileSystem.FileExists(FileName) = False Then
Debug.Print("File not found.")
Exit Sub
End If
FileContents = My.Computer.FileSystem.ReadAllText(FileName)
Page = Encoder.Encode_Page(FileContents, Content_Type)
Debug.Print(Encoder.Error_String)
Debug.Print(Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Debug.Print(Encoder.Error_String)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
Page = Encoder.Encode_Page(Page, Content_Type)
Page = Decoder.Decode_Page(Page, Content_Type)
'Debug.Print(Content_Type)
Debug.Print(Page)
Debug.Print("Program took " & (My.Computer.Clock.TickCount - start).ToString & " miliseconds")
End Sub
My computer is set up for UK English.
|
|
|
|
|
My computer is set up for Latvian. But i don't think, this is cause of problem.
Another question:
Source code on your computer and here is same?
|
|
|
|
|
Source code is the same. I downloaded the code from codeproject, ran it and it worked with the syncml page.
|
|
|
|
|
Ok, thanks for the help. Something strange happens....
|
|
|
|
|
Hi Darren,
first of all many thanks for the article and the example.
I've a copule of questions:
1. MAC calculation: using SHA1, it is always 20byte instead of 40 byte. do you know how to generate 40 byte MAC?
2. Message reference number in the UDH can be different than the Transaction ID?
My main focus is to deliver OTA Prov docs via SMS.
Thanks a lot
BC007
|
|
|
|
|
Hello,
It took me a few minutes to understand the finer points of your question. The SHA1 hash calculation is done by the security class in .Net. Here's a link to the msdn page.
(http://msdn2.microsoft.com/en-us/library/system.security.cryptography.hmacsha1.aspx[^])
The sha1 function does indeed return a 20 byte string. For transmission over SMS and wap push this needs to be converted to an ASCII string.
For example say this is our SHA1 calculated hash code:
?HMAC
{Length=20}
(0): 158
(1): 67
(2): 14
(3): 49
(4): 25
(5): 86
(6): 221
(7): 49
(8): 23
(9): 138
(10): 47
(11): 236
(12): 209
(13): 107
(14): 128
(15): 234
(16): 222
(17): 122
(18): 51
(19): 254
In Hex this is:
?HMAC
{Length=&H14}
(&H0): &H9E
(&H1): &H43
(&H2): &HE
(&H3): &H31
(&H4): &H19
(&H5): &H56
(&H6): &HDD
(&H7): &H31
(&H8): &H17
(&H9): &H8A
(&Ha): &H2F
(&Hb): &HEC
(&Hc): &HD1
(&Hd): &H6B
(&He): &H80
(&Hf): &HEA
(&H10): &HDE
(&H11): &H7A
(&H12): &H33
(&H13): &HFE
So therefore our ascii string is:
"9E430E311956DD31178A2FECD16B80EADE7A33FE"
Does this answer the first question?
For the second question, I not aware of any relationship between the Transaction ID in the wap push and the Message reference number in the SMS UDH. The Transaction ID is used with wap gateways and the Meassage reference is used/set by the phone (part of the SMS specs stipulate that the message reference must be incremented by the phone after each sms is sent (or words to that effect)).
Bests regards
Darren.
p.s I've included below a ethereal trace showing a provisioning example over a wap push over UDP/IP.
No. Time Source Destination Protocol Info
4 165.771595 192.168.1.2 149.254.1.10 WSP WSP Push (0x06) (WBXML 1.3, Public ID: "-//WAPFORUM//DTD PROV 1.0//EN (Provisioning 1.0)")
Frame 4 (480 bytes on wire, 480 bytes captured)
Arrival Time: Jan 24, 2006 01:09:10.707666000
[Time delta from previous packet: 49.049126000 seconds]
[Time since reference or first frame: 165.771595000 seconds]
Frame Number: 4
Packet Length: 480 bytes
Capture Length: 480 bytes
[Frame is marked: False]
[Protocols in frame: eth:ip:udp:wsp:wbxml]
[Coloring Rule Name: UDP]
[Coloring Rule String: udp]
Ethernet II, Src: CompaqCo_d4:64:bb (00:08:02:d4:64:bb), Dst: D-Link_a0:1b:97 (00:11:95:a0:1b:97)
Destination: D-Link_a0:1b:97 (00:11:95:a0:1b:97)
Address: D-Link_a0:1b:97 (00:11:95:a0:1b:97)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: CompaqCo_d4:64:bb (00:08:02:d4:64:bb)
Address: CompaqCo_d4:64:bb (00:08:02:d4:64:bb)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Type: IP (0x0800)
Internet Protocol, Src: 192.168.1.2 (192.168.1.2), Dst: 149.254.1.10 (149.254.1.10)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
0000 00.. = Differentiated Services Codepoint: Default (0x00)
.... ..0. = ECN-Capable Transport (ECT): 0
.... ...0 = ECN-CE: 0
Total Length: 466
Identification: 0xfda8 (64936)
Flags: 0x00
0... = Reserved bit: Not set
.0.. = Don't fragment: Not set
..0. = More fragments: Not set
Fragment offset: 0
Time to live: 128
Protocol: UDP (0x11)
Header checksum: 0xe2bf [correct]
[Good: True]
[Bad : False]
Source: 192.168.1.2 (192.168.1.2)
Destination: 149.254.1.10 (149.254.1.10)
User Datagram Protocol, Src Port: 4906 (4906), Dst Port: 2948 (2948)
Source port: 4906 (4906)
Destination port: 2948 (2948)
Length: 446
Checksum: 0xc632 [correct]
Wireless Session Protocol, Method: Push (0x06), Content-Type: application/vnd.wap.connectivity-wbxml
Transaction ID: 0x03
PDU Type: Push (0x06)
Headers Length: 47
Content-Type: application/vnd.wap.connectivity-wbxml; SEC=USERPIN; MAC=E0BA2874CF6E07867F73F9B31567ECA8C0548053
SEC: USERPIN (0x01)
MAC: E0BA2874CF6E07867F73F9B31567ECA8C0548053
WAP Binary XML, Version: 1.3, Public ID: "-//WAPFORUM//DTD PROV 1.0//EN (Provisioning 1.0)"
Version: 1.3 (0x03)
Public Identifier (known): -//WAPFORUM//DTD PROV 1.0//EN (Provisioning 1.0) (0x0000000b)
Character Set: utf-8 (0x0000006a)
String table: 0 bytes
Data representation
Level | State | Codepage | WBXML Token Description | Rendering
0 | Tag | T 0 | Known Tag 0x05 (.C) | <wap-provisioningdoc>
1 | Tag | T 0 | Known Tag 0x06 (AC) | <characteristic
1="" |="" attr="" a="" 0="" known="" attrstart="" 0x55="" type="NAPDEF"
="" tag="" t="" end="" (attribute="" list)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x11="" name="NAPID"
="" 0x06="" value="
" str_i="" (inline="" string)="" 't-mobile="" gprs'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x07="" name="NAME"
="" 0x06="" value="
" str_i="" (inline="" string)="" 't-mobile="" gprs'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x10="" name="BEARER"
="" 0x06="" value="
" attrvalue="" 0x2b="" 'gsm-gprs'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x08="" name="NAP-ADDRESS"
="" 0x06="" value="
" str_i="" (inline="" string)="" 'general.t-mobile.uk'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x09="" name="NAP-ADDRTYPE"
="" 0x06="" value="
" attrvalue="" 'apn'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x06 (AC) | <characteristic
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x5a="" type="NAPAUTHINFO"
="" tag="" t="" end="" (attribute="" list)="">
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x0c="" name="AUTHTYPE"
="" 0x06="" value="
" attrvalue="" 0x1a="" 'pap'
="" tag="" t="" end="" (known="" tag)="">
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x0d="" name="AUTHNAME"
="" 0x06="" value="
" str_i="" (inline="" string)="" 'user'
="" tag="" t="" end="" (known="" tag)="">
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x0e="" name="AUTHSECRET"
="" 0x06="" value="
" str_i="" (inline="" string)="" 'wap'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | END (Known Tag 0x06) |
1 | Tag | T 0 | END (Known Tag 0x06) |
1 | Tag | T 0 | Known Tag 0x06 (AC) | <characteristic
1="" |="" attr="" a="" 0="" known="" attrstart="" 0x51="" type="PXLOGICAL"
="" tag="" t="" end="" (attribute="" list)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x15="" name="PROXY-ID"
="" 0x06="" value="
" str_i="" (inline="" string)="" '149.254.001.010'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x07="" name="NAME"
="" 0x06="" value="
" str_i="" (inline="" string)="" 't-mobile="" gprs'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x1c="" name="STARTPAGE"
="" 0x06="" value="
" str_i="" (inline="" string)="" 'http:="" www.t-zones.co.uk'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x06 (AC) | <characteristic
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x52="" type="PXPHYSICAL"
="" tag="" t="" end="" (attribute="" list)="">
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x20="" name="PXADDR"
="" 0x06="" value="
" str_i="" (inline="" string)="" '149.254.001.010'
="" tag="" t="" end="" (known="" tag)="">
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x21="" name="PXADDRTYPE"
="" 0x06="" value="
" attrvalue="" 0x05="" 'ipv4'
="" tag="" t="" end="" (known="" tag)="">
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x22="" name="TO-NAPID"
="" 0x06="" value="
" str_i="" (inline="" string)="" 't-mobile="" gprs'
="" tag="" t="" end="" (known="" tag)="">
3 | Tag | T 0 | Known Tag 0x06 (AC) | <characteristic
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x53="" type="PORT"
="" tag="" t="" end="" (attribute="" list)="">
4 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
4="" |="" attr="" a="" 0="" known="" attrstart="" 0x23="" name="PORTNBR"
="" 0x06="" value="
" str_i="" (inline="" string)="" '9201'
="" tag="" t="" end="" (known="" tag)="">
4 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
4="" |="" attr="" a="" 0="" known="" attrstart="" 0x24="" name="SERVICE"
="" 0x06="" value="
" attrvalue="" 0x4b="" 'co-wsp'
="" tag="" t="" end="" (known="" tag)="">
3 | Tag | T 0 | END (Known Tag 0x06) |
2 | Tag | T 0 | END (Known Tag 0x06) |
1 | Tag | T 0 | END (Known Tag 0x06) |
1 | Tag | T 0 | Known Tag 0x06 (AC) | <characteristic
|="" attr="" a="" --=""> 1 | SWITCH_PAGE (Attr code page) |
1 | Attr | A 1 | Known attrStart 0x55 | type='APPLICATION'
1 | Tag | T 0 | END (attribute list) | >
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 1="" known="" attrstart="" 0x36="" name="APPID"
="" --=""> 0 | SWITCH_PAGE (Attr code page) |
2 | Attr | A 0 | Known attrStart 0x06 | value=
2 | Attr | A 0 | STR_I (Inline string) | 'w2'
2 | Tag | T 0 | END (Known Tag) | />
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
2="" |="" attr="" a="" 0="" known="" attrstart="" 0x07="" name="NAME"
="" 0x06="" value="
" str_i="" (inline="" string)="" 't-zones'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
|="" attr="" a="" --=""> 1 | SWITCH_PAGE (Attr code page) |
2 | Attr | A 1 | Known attrStart 0x39 | name='TO-PROXY'
| Attr | A --> 0 | SWITCH_PAGE (Attr code page) |
2 | Attr | A 0 | Known attrStart 0x06 | value=
2 | Attr | A 0 | STR_I (Inline string) | '149.254.001.010'
2 | Tag | T 0 | END (Known Tag) | />
2 | Tag | T 0 | Known Tag 0x06 (AC) | <characteristic
|="" attr="" a="" --=""> 1 | SWITCH_PAGE (Attr code page) |
2 | Attr | A 1 | Known attrStart 0x59 | type='RESOURCE'
2 | Tag | T 0 | END (attribute list) | >
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 1="" known="" attrstart="" 0x3a="" name="URI"
="" --=""> 0 | SWITCH_PAGE (Attr code page) |
3 | Attr | A 0 | Known attrStart 0x06 | value=
3 | Attr | A 0 | STR_I (Inline string) | 'http://www.t-zones.co.uk'
3 | Tag | T 0 | END (Known Tag) | />
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x07="" name="NAME"
="" 0x06="" value="
" str_i="" (inline="" string)="" 't-zones'
="" tag="" t="" end="" (known="" tag)="">
3 | Tag | T 0 | Known Tag 0x07 (A.) | <parm
3="" |="" attr="" a="" 0="" known="" attrstart="" 0x1c="" name="STARTPAGE"
="" 0x06="" value="
" str_i="" (inline="" string)="" 'http:="" www.t-zones.co.uk'
="" tag="" t="" end="" (known="" tag)="">
2 | Tag | T 0 | END (Known Tag 0x06) |
1 | Tag | T 0 | END (Known Tag 0x06) |
0 | Tag | T 0 | END (Known Tag 0x05) |
0000 00 11 95 a0 1b 97 00 08 02 d4 64 bb 08 00 45 00 ..........d...E.
0010 01 d2 fd a8 00 00 80 11 e2 bf c0 a8 01 02 95 fe ................
0020 01 0a 13 2a 0b 84 01 be c6 32 03 06 2f 1f 2d b6 ...*.....2../.-.
0030 91 81 92 45 30 42 41 32 38 37 34 43 46 36 45 30 ...E0BA2874CF6E0
0040 37 38 36 37 46 37 33 46 39 42 33 31 35 36 37 45 7867F73F9B31567E
0050 43 41 38 43 30 35 34 38 30 35 33 00 03 0b 6a 00 CA8C0548053...j.
0060 45 c6 55 01 87 11 06 03 54 2d 4d 6f 62 69 6c 65 E.U.....T-Mobile
0070 20 47 50 52 53 00 01 87 07 06 03 54 2d 4d 6f 62 GPRS......T-Mob
0080 69 6c 65 20 47 50 52 53 00 01 87 10 06 ab 01 87 ile GPRS........
0090 08 06 03 67 65 6e 65 72 61 6c 2e 74 2d 6d 6f 62 ...general.t-mob
00a0 69 6c 65 2e 75 6b 00 01 87 09 06 89 01 c6 5a 01 ile.uk........Z.
00b0 87 0c 06 9a 01 87 0d 06 03 75 73 65 72 00 01 87 .........user...
00c0 0e 06 03 77 61 70 00 01 01 01 c6 51 01 87 15 06 ...wap.....Q....
00d0 03 31 34 39 2e 32 35 34 2e 30 30 31 2e 30 31 30 .149.254.001.010
00e0 00 01 87 07 06 03 54 2d 4d 6f 62 69 6c 65 20 47 ......T-Mobile G
00f0 50 52 53 00 01 87 1c 06 03 68 74 74 70 3a 2f 2f PRS......http://
0100 77 77 77 2e 74 2d 7a 6f 6e 65 73 2e 63 6f 2e 75 www.t-zones.co.u
0110 6b 00 01 c6 52 01 87 20 06 03 31 34 39 2e 32 35 k...R.. ..149.25
0120 34 2e 30 30 31 2e 30 31 30 00 01 87 21 06 85 01 4.001.010...!...
0130 87 22 06 03 54 2d 4d 6f 62 69 6c 65 20 47 50 52 ."..T-Mobile GPR
0140 53 00 01 c6 53 01 87 23 06 03 39 32 30 31 00 01 S...S..#..9201..
0150 87 24 06 cb 01 01 01 01 c6 00 01 55 01 87 36 00 .$.........U..6.
0160 00 06 03 77 32 00 01 87 07 06 03 74 2d 7a 6f 6e ...w2......t-zon
0170 65 73 00 01 87 00 01 39 00 00 06 03 31 34 39 2e es.....9....149.
0180 32 35 34 2e 30 30 31 2e 30 31 30 00 01 c6 00 01 254.001.010.....
0190 59 01 87 3a 00 00 06 03 68 74 74 70 3a 2f 2f 77 Y..:....http://w
01a0 77 77 2e 74 2d 7a 6f 6e 65 73 2e 63 6f 2e 75 6b ww.t-zones.co.uk
01b0 00 01 87 07 06 03 74 2d 7a 6f 6e 65 73 00 01 87 ......t-zones...
01c0 1c 06 03 68 74 74 70 3a 2f 2f 77 77 77 2e 74 2d ...http://www.t-
01d0 7a 6f 6e 65 73 2e 63 6f 2e 75 6b 00 01 01 01 01 zones.co.uk.....
|
|
|
|
|
Thanks Darren.
Yes you have answered my question; now it partially works but unfortunately I still have some issues.
When I use SEC=USERPIN, MAC is ok (after hex to ascii is applied), but unfortunately, when I apply SEC=NETWPIN it doesn't work.
In this case, NETWPIN, IMSI is used as shared secret; I've considered IMSI shall be represented in semi-octets adding also "9" in case of 15-digits IMSI. I've tested several combinations and coding for IMSI, but result is always negative.
I can see MAC you generate is different from MAC generated with NowSMS, my benchmark. MAC generated by NowSMS is ok and handset accept ProvDoc.
Note, WBXML is matching between your class and NowSMS.
What's wrong? have you verified NETWPIN as SEC?
Thanks again
|
|
|
|
|
|
Hi,
Add the following blocks of code to the wbxml_class.
To get a mac for example:
tbHMAC.Text = Encoder.HMAC_Calculate(WBXML_Coder_Class.enum_WSP_SEC.USERPINMAC, txtimsi.Text, tbPinCode.Text, toolbox.Ascii_to_Hex(Page))
I've not yet tested the code with an actual phone.
Best Regards,
Darren.
'#####################################################################
Public Enum enum_WSP_SEC
NETWPIN = &H80
USERPIN = &H81
USERNETWPIN = &H82
USERPINMAC = &H83
End Enum
Public Function GetKeyFromImsi(ByVal Imsi As String) As String
GetKeyFromImsi = ""
'get rid of whitespace
Imsi = Left(Imsi.Trim, 15)
'convert to hexstring
If Imsi.Length Mod 2 > 0 Then
'odd number of digits
Imsi = "9" & Imsi
Else
'even number of digits
Imsi = "1" & Imsi & "F"
End If
GetKeyFromImsi = Toolbox.TransposeDigits(Imsi)
End Function
Public Function HMAC_Calculate(ByVal Method As enum_WSP_SEC, _
ByVal Imsi As String, _
ByRef Pin As String, _
ByVal WBXML_Page As String) As String
HMAC_Calculate = ""
Dim key As String = ""
Select Case Method
Case enum_WSP_SEC.NETWPIN
'Encode using an Imsi
key = GetKeyFromImsi(Imsi)
key = Toolbox.Hex_to_Ascii(key)
Case enum_WSP_SEC.USERPIN
'Encode using a Pin
key = Pin
Case enum_WSP_SEC.USERNETWPIN
'Encode using an Imsi and Pin
key = GetKeyFromImsi(Imsi)
key = Toolbox.Hex_to_Ascii(key) & Pin
Case enum_WSP_SEC.USERPINMAC
'http://www.wmlclub.com/docs/especwap2.0/WAP-184-PROVBOOT-20010314-a.pdf
'wap prov doc, page 14
Dim L As Integer = 6
'1) let A be the wbxml document
'2) generate a random string K of decimal digits with length L (L must be greater than 4)
Dim K As String = Format(Now, "mmssHH")
'3) calculate the array of octets M=HMACK-SHA(K,A)
Dim M As String = HMAC_Calculate(K, WBXML_Page)
'4) Generate a string N of length L from M according to N(i) = M(i) mod 10 + 48,
' where i refers to the individual elements of the string N and array M, respectively.
Dim N As String = ""
For i As Integer = 1 To L * 2 Step 2
N = N & Chr(CInt(Val("&h" & Mid(M, i, 2)) Mod 10) + 48)
Next
'5) Generate the PIN code C as a concatenation C = K || N.
Dim C As String = K & N
Pin = C
HMAC_Calculate = "Hash value is contained in the Pin."
Exit Function
End Select
HMAC_Calculate = HMAC_Calculate(key, WBXML_Page)
End Function
|
|
|
|
|
Hi Darren,
I've understood your changes and extensions,
however "key" calculation in case of NETWPIN is not working.
take below example:
key=GetKeyFromImsi("222012100014513")
' key is 2922101200105431 assuming I've correctly understood TransposeDigits()
key=Toolbox.Hex_to_Ascii(key) 'it is new in toolbox. My view:
' key here is 8 lenght as char(29)+char(22)+char(10)...
tMAC = Toolbox.Ascii_to_Hex(Encoder.HMAC_Calculate(tMAC, Toolbox.Ascii_to_Hex(tWBXML)))
' MAC is wrong
I'm not sure regarding Toolbox.Hex_to_Ascii(key); shall I use something similar to: Chr(CInt(Val("&h" & Mid(M, i, 2)) Mod 10) + 48) or what else?
thanks
|
|
|
|
|
Done!!! I'll try later the other SEC methods... Really thanks for your help.
Case WBXML_Coder_Class.enum_WSP_SEC.NETWPIN
'Encode using an Imsi
tMAC = Encoder.GetKeyFromImsi(wspPIN.Text)
tMAC = Toolbox.Hex_to_Ascii(tMAC)
tMAC = Toolbox.Ascii_to_Hex(Encoder.HMAC_Calculate(tMAC, Toolbox.Ascii_to_Hex(tWBXML)))
with:
Public Function Hex_to_Ascii(ByVal HexStringa As String) As String
Hex_to_Ascii = ""
Dim x As Integer
For x = 1 To CInt(HexStringa.Length) Step 2
Hex_to_Ascii += Chr(CInt("&h" & Mid(HexStringa, x, 2)))
Next
End Function
|
|
|
|
|
Hi,
Here's the missing function.
Public Function TransposeDigits(ByVal DigitStr As String) As String
TransposeDigits = ""
For x As Integer = 0 To DigitStr.Length - 1 Step 2
TransposeDigits += DigitStr.Substring(x + 1, 1) + _
DigitStr.Substring(x, 1)
Next
End Function
You need to provide some more information. Does UserPin work for you?.
All these methods are detailed in the wap specifications. I've just coded them verbatim. The Sha1 encoding is done by Windows. What is the wbxml you are using for the test?. What is the MAC supposed to be?.
For the imsi above the key been piped to the sha1 function is
?KeyByte
{Length=&H8}
(&H0): &H29
(&H1): &H22
(&H2): &H10
(&H3): &H12
(&H4): &H0
(&H5): &H10
(&H6): &H54
(&H7): &H31
Bear in mind the MAC is also dependant on the wbxml document. A single byte difference will give a completely different MAC.
Regards,
Darren.
|
|
|
|
|
>>TransposeDigits
yes, I've delivered similar function providing same result
>>Does UserPin work for you?
yes, it works well; your original example here calculates MAC correctly.
>>All these methods are detailed in the wap specifications. I've just coded them verbatim.
yes, I know. The difference I faced between USERPIN and NETWPIN is as below.
basic function to calculate MAC (my variable is called tMAC) is:
tMAC = Toolbox.Ascii_to_Hex(Encoder.HMAC_Calculate(key, Toolbox.Ascii_to_Hex(tWBXML)))
where
key is a String
tWBXML = Encoder.Encode_Page(sXML.Text, Content_Type)
in case of USERPIN, key can be directly the PIN, like "1234" (i place key=textObject.Text, using always 4 numeric digits)
in case of NETWPIN, key shall be 8 chars obtained with Hex_to_Ascii of the 16 digists IMSI (this additional step was new to me since specs just states IMSI shall be semi-octets haing '9' on top in case of 15 digits IMSI). I was wrongly passing 16 chars directly as key!
Let me confirm that in both cases, USERPIN and NETWPIN, I'm now able to create correct MAC: having exactly same original XML, MAC I calculate is same as NowSMS (my benchmark) and the whole message is correctly accepted by the handset.
All is clear and working in my side; I just have to code and test USERNETWPIN and USERPINMAC.
Really thank you for your support.
Cheers
|
|
|
|
|
Thank you for very good article...
How do send this to the phone via SMS?
Regds
Inge
|
|
|
|
|
Hi Inge,
To send an xml document over SMS you first converted it to binary format using the library. You then stuff this data into a wap push which is then the payload for the SMS. In the SMS you need to specify a header specifying the address port for a wap push. Bear in mind these xml documents are big'ish and span multiple SMS's so concatenated SMS's are required. It in not very straight forward!. Here's an example of a MMS in a wap push via SMS. It spans 2 SMS's.
'079144978578898644038131F900F5201172413534008C0B05040B8423F000035D02015E06226170706C69636174696F6E2F766E642E7761702E6D6D732D6D65737361676500AF848C82985065546356676F6546494D4141436D434141414142674141416D414141414141008D908919802B3434373935373737383130392F545950453D504C4D4E008A808E0219C98805810301518083687474703A2F2F31302E3330
'
'07 smsc address length
'
'91 smsc address type
'
'44 97 85 78 89 86 smsc address
'
'44 SMS message type, DELIVER
' TP-Message-Type-Indicator bit 0 & 1, =0, DELIVER
' TP-More-Messages-To-Send bit 2 =0, More messages are waiting for this MS in SC
' TP-Reply-Path bit 7 =0, Parameter is not set
' TP-User-Data-Header-Indicator bit 6 =0, TP-UD field only contains the sms
' TP-Status-Report-Indicator bit 5 =0, Not requested
'
'03 Sender address length
'81 Sender address type, Type of address=unknown, numbering plan=ISDN
'31 F9 Sender address,139
'
'00 TP-PID, Protocol identifier
' no interworking, but SME-to-SME protocol (page 54 TS 3.40)
' straight forward SMS is 0
'
'F5 TP-DCS, Data coding scheme
'
'20 11 72 41 35 34 00 TP-SCTS, time stamp (02/11/27 14:53:43:00),
' the last octet is the time zone
'
'8C TP-UDL, data packet length=140 ,includes the headers
'
'
' TP -UHD
'0B Length of TP-UHD 11
'
'05 Information Element Identifier 05,
' Application Port Addressing Scheme, 16 bit address
'04 Length of IE
'0B 84 Destination Address, 2948
'23 F0 Originator Address, 9200
'
'00 Information Element Identifier 00,concatenated sms
'03 Length of Information Element Identifier 00
'5D Reference Number
'02 Number of packets
'01 SMS/Packet sequence number
'
'
'(This is the start of the SMS data payload, in this case a wap push. This is where a binary XML document would be.)
'5E push ID (Random id)
'06 Push, pdu Type (Wap Push)
'22 Length of headers & content, 34
'
'61 70 70 6C 69 63 61 74 69 6F application/vnd.wap.mms-message
'6E 2F 76 6E 64 2E 77 61 70 2E
'6D 6D 73 2D 6D 65 73 73 61 67
'65 00
'AF X-Wap-Application-Id (WAP 230 spec)
'84 Push-Application-ID (WAP 209 spec)
'
'(This is the start of the Wap Push data payload i.e. the MMS notification.)
'8C 82 Message Type (8c) -> notification (82)
'
'98 Transaction ID
'
'50 65 54 63 56 67 6F 65 46 49 PeTcVgoeFIMAACmCAAAABgAAAmAAAAAA
'4D 41 41 43 6D 43 41 41 41 41
'42 67 41 41 41 6D 41 41 41 41
'41 41 00
'
'8D 90 mms version (8d), Bit 4 to bit 6 major version number = 1,
' Bit 0 to bit 3 minor version number = 0
'
'
'89 19 FROM, length=25
'80 address present
'
'2B 34 34 37 39 35 37 37 37 38 +447957778109/TYPE=PLMN
'31 30 39 2F 54 59 50 45 3D 50
'4C 4D 4E 00
' 96=subject
'8A 80 message class (8a),Personal (80)
'8E 02 19 C9 message size, 2 octets, &h19c1
'88 05 81 03 01 51 80 Expiry (88) , length, Relative (81), 196945
'83 83=content location
'
'68 74 74 70 3A 2F 2F 31 30 2E http://10.30
'33 30
'
'
'
SMS Number 2
'0,,73||079144978578898644038131F900F5201172413544003A0B05040B8423F000035D02022E32302E3133313A383030322F5065546356676F6546494D4141436D434141414142674141416D41414141414100"
'
'
'91
'449785788986
'44
'03
'8131 F9
'00
'F5
'20
'11 72 41 35 44 00
'
'3A=58 Packet Length
'
'0B 05 04 0B 84 23 F0 UDH
'00
'03 5D 02
'02 SMS/Packet sequence number
'
'2E 32 30 2E 31 33 31 3A 38 30 .20.131:8002/PeTcVgoeFIMAACmCAAAABgAAAmAAAAAA
'30 32 2F 50 65 54 63 56 67 6F
'65 46 49 4D 41 41 43 6D 43 41
'41 41 41 42 67 41 41 41 6D 41
'41 41 41 41 41 00
'
This is an extract from a document expanding a bit on the port addressing stuff.
#################################
Sony Ericsson OTA Settings
In order to make handsets accept browser, SyncML and WV settings sent over the air, the settings must be provided in a binary encoded XML document with a specific MIME-type depending on the setting type. The settings must be pushed over SMS to a predefined WDP port as a WSP connection less unsecured push. This predefined WDP port for browser settings is 49999, for Wireless Village settings 49997 and for SyncML settings 49996. Handsets able to receive settings over the air must always listen on this port.
##################################
Here is a received provisioning message from a network operator,
VFNZ PXT (MMS)
+CMTI: "SM", 1
+CMTI: "SM", 1
at+cmgr=1
+CMGR: 0,,155
0691566948959944048177073BF5502140219172238C0B0504C34F23F00003200201 01062C1F2A61
70706C69636174696F6E2F782D7761702D70726F762E62726F777365722D73657474696E67730081
EA01016A0045C6060187124901871311033137322E3033302E3033382E3030330001871461018722
7001877E110356464E5A205058540001871C11036C6976652E766F6461666F6E652E636F6D000101
C608
+CMGR: 0,,132
0691566948959944048177073BF550214021918223750B0504C34F23F00003200202 018715110356
464E5A20505854000101C67F0187151103566F6461666F6E65000187171103687474703A2F2F6C69
76652E766F6461666F6E652E636F6D000101867C1103687474703A2F2F7078742E766F6461666F6E
652E6E65742E6E7A2F70787473656E64000101
OK
This is the wap push
01062C1F2A6170706C69636174696F6E2F782D7761702D70726F762E62726F777365722D73657474696E67730081EA01016A0045C6060187124901871311033137322E3033302E3033382E30303300018714610187227001877E110356464E5A205058540001871C11036C6976652E766F6461666F6E652E636F6D000101C608018715110356464E5A20505854000101C67F0187151103566F6461666F6E65000187171103687474703A2F2F6C6976652E766F6461666F6E652E636F6D000101867C1103687474703A2F2F7078742E766F6461666F6E652E6E65742E6E7A2F70787473656E64000101
Id: 01
Wap Push: 06
Length of headers: 2c (44)
Content length: 1f 2a
Content Type: application/x-wap-prov.browser-settings
Charset: utf-8 (81 ea)
This is the binary encoded XML
01016A0045C6060187124901871311033137322E3033302E3033382E30303300018714610187227001877E110356464E5A205058540001871C11036C6976652E766F6461666F6E652E636F6D000101C608018715110356464E5A20505854000101C67F0187151103566F6461666F6E65000187171103687474703A2F2F6C6976652E766F6461666F6E652E636F6D000101867C1103687474703A2F2F7078742E766F6461666F6E652E6E65742E6E7A2F70787473656E64000101
This is the decoded binary XML
<characteristic-list>
<characteristic type="ADDRESS">
<parm name="BEARER" value="GPRS">
<parm name="PROXY" value="172.030.038.003">
<parm name="PORT" value="9201">
<parm name="PPP_AUTHTYPE" value="PAP">
<parm name="ISP_NAME" value="VFNZ PXT">
<parm name="GPRS_ACCESSPOINTNAME" value="live.vodafone.com">
<characteristic type="NAME">
<parm name="NAME" value="VFNZ PXT">
<characteristic type="BOOKMARK">
<parm name="NAME" value="Vodafone">
<parm name="URL" value="http://live.vodafone.com">
<characteristic type="MMSURL" value="http://pxt.vodafone.net.nz/pxtsend">
Best Regards
Darren.
|
|
|
|
|
|
Dazzer
Thanks for the article. I am just having a go at using the document to parse SyncML wbxml documents and am finding a couple of issues. I have a wbxml document from a Nokia 6600. The 6600 supports SyncML 1.1. The public identifier is &H53. Therefore I have added the following to Ppoulate_DTD_Table
Add("-//SYNCML//DTD SyncML 1.1//EN", &H53, "http://www.syncml.org/docs/syncml_represent_v11_20020213.dtd", DTD_Class.enum_XML_Type.SyncML_1_1, "SyncML", "", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
to get it to decode the document.
James
|
|
|
|
|
Hi,
There is already an entry for "-//SYNCML//DTD SyncML 1.1//EN" and it's wbxml public identifier is &hfd1 ( page 38 of http://www.openmobilealliance.org/tech/affiliates/syncml/syncml_represent_v11_20020215.pdf). Can you tell me where you found the value &h53?. I did some digging on the Nokia developer site and found yet another syncml 1.1 definition. The specs are very confusing for syncml 1.1. For SyncML v1.1 the specs say use id &hFD1 and then in the specs for SyncML 1.1.2 they say use &hFD3.
Anyway here is the updated SyncML section of the DTD table. I've made a lot of changes.
Replace the old syncML section with this...
'according to syncml_represent_v10_20001207.pdf, syncml 1.0 doc, code page 0
Add("-//SYNCML//DTD SyncML 1.0//EN", &HFD1, "http://www.syncml.org/docs/syncml_represent_v10_20001207.dtd", DTD_Class.enum_XML_Type.SyncML_1_0, "SyncML", "", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
'http://www.syncml.org/docs/syncml_metinf_v101_20010615.pdf syncml 1.0.1 metainf page 16, code page 1
Add("-//SYNCML//DTD MetInf 1.0//EN", &HFD1, "http://www.syncml.org/docs/syncml_metinf_v10_20001207.dtd", DTD_Class.enum_XML_Type.MetInf_1_0, "MetInf", "", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
'http://www.syncml.org/docs/syncml_devinf_v101_20010615.pdf syncml 1.0.1 devinf page 27
Add("-//SYNCML//DTD DevInf 1.0//EN", &HFD2, "http://www.syncml.org/docs/syncml_devinf_v10_20001207.dtd", DTD_Class.enum_XML_Type.DevInf_1_0, "DevInf", "", "application/vnd.syncml-devinf+wbxml", "application/vnd.syncml-devinf+xml")
'http://www.syncml.org/docs/syncml_represent_v11_20020215.pdf syncml 1.1 says &hfd1
'ethereal and OMA-SyncML-RepPro-V1_1_2-20030612-A.pdf syncml 1.1.2 says this is &hfd3
Add("-//SYNCML//DTD SyncML 1.1//EN", &HFD3, "http://www.syncml.org/docs/syncml_represent_v11_20020213.dtd", DTD_Class.enum_XML_Type.SyncML_1_1, "SyncML", "", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
Add("-//OMA//DTD SYNCML 1.1//EN", &HFD3, "http://www.openmobilealliance.org/tech/DTD/OMA-SyncML-RepPro-DTD-V1_1_2-20030505-D.dtd", DTD_Class.enum_XML_Type.SyncML_1_1, "SyncML", "SyncML Representation Protocol (SYNCML) V1.1 Document Type Definition", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
'http://www.syncml.org/docs/syncml_metinf_v11_20020215.pdf, code page 1 says &hfd1
Add("-//SYNCML//DTD MetInf 1.1//EN", &HFD3, "http://www.syncml.org/docs/syncml_metinf_v11_20020215.dtd", DTD_Class.enum_XML_Type.MetInf_1_1, "MetInf", "", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
Add("-//OMA//DTD SYNCML-METINF 1.1//EN", &HFD3, "http://www.openmobilealliance.org/DTD/OMA-SyncML-Meta_Information-DTD-1.1.2-20030221-D.dtd", DTD_Class.enum_XML_Type.MetInf_1_1, "MetInf", "", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
'http://www.syncml.org/docs/syncml_devinf_v11_20020215.pdf, code page 0 says &hfd2
'OMA-SyncML-DevInfo-V1_2-200400601-C says &hfd4
Add("-//SYNCML//DTD DevInf 1.2//EN", &HFD4, "http://www.openmobilealliance.org/tech/DTD/OMA-SyncMLDevice_Information-DTD-1.2.dtd", DTD_Class.enum_XML_Type.DevInf_1_1, "DevInf", "", "application/vnd.syncml-devinf+wbxml", "application/vnd.syncml-devinf+xml")
Add("-//OMA//DTD SYNCML-DEVINF 1.1//EN", &HFD4, "http://www.syncml.org/docs/devinf_v11_20020215.dtd", DTD_Class.enum_XML_Type.DevInf_1_1, "DevInf", "", "application/vnd.syncml-devinf+wbxml", "application/vnd.syncml-devinf+xml")
Add("-//SYNCML//DTD SyncML 1.2//EN", &H1201, "http://www.openmobilealliance.org/tech/DTD/OMA-SyncML-RepPro-DTD-V1_1_2-20030505-D.dtd", DTD_Class.enum_XML_Type.SyncML_1_2, "SyncML", "OMA Data Synchronization (SyncML) Representation Protocol DTD v1.2", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
Add("-//SYNCML//DTD MetaInf 1.2//EN", &H1202, "http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_MetaInfo_DTD-V1_2.dtd", DTD_Class.enum_XML_Type.MetInf_1_2, "MetInf", "OMA Data Synchronization (SyncML) Meta Information DTD v1.2", "application/vnd.syncml+wbxml", "application/vnd.syncml+xml")
Add("-//SYNCML//DTD DevInf 1.2//EN", &H1203, "http://www.openmobilealliance.org/DTD/OMA-SyncML-DevInfo-DTD-V1_1_2-20030505-D.dtd", DTD_Class.enum_XML_Type.DevInf_1_2, "DevInf", "OMA Data Synchronization (SyncML) Device Information DTD v1.2", "application/vnd.syncml.dm+wbxml", "application/vnd.syncml.dm+xml")
Secondly I found a bug in the ML parser Get_Tag function.
Replace
'if the next char is a "/" then it is part of the tag
If Mid(ML_Page, Page_Pointer + 1, 1) = "/" Then
ML_Page_Array(ML_Page_Array_Count).ML_Value += "/"
Page_Pointer += 2 ' the whitespace and the "/"
Current_Char = Mid(ML_Page, Page_Pointer, 1)
with
'if the next char is a "/" then it is part of the tag
If Mid(ML_Page, Page_Pointer + 1, 1) = "/" And Mid(ML_Page, Page_Pointer + 2, 1) = ">" Then
ML_Page_Array(ML_Page_Array_Count).ML_Value += "/"
Page_Pointer += 2 ' the whitespace and the "/"
Current_Char = Mid(ML_Page, Page_Pointer, 1)
My ML_Parser is not the best!!.
Here are 2 examples of nokia syncml 1.1 documents I found on the web,
Example 1.
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<!DOCTYPE SyncML PUBLIC
'-//OMA//DTD SYNCML 1.1//EN'
'http://www.openmobilealliance.org/DTD/OMA-SyncML-RepPro-DTD-V1_1_2-20030505-D.dtd'
>
<!--
see SyncML Sync Protocol, version 1.1.2; chapter 13.1 Sync Alert
-->
<SyncML xmlns='SYNCML:SYNCML1.1'>
<SyncHdr>
<VerDTD>1.1</VerDTD>
<VerProto>SyncML/1.1</VerProto>
<SessionID>1</SessionID>
<MsgID>1</MsgID>
<Target>
<LocURI>/</LocURI>
</Target>
<Source>
<LocURI>GSM Remote ML</LocURI>
</Source>
</SyncHdr>
<SyncBody>
<Alert>
<CmdID>1</CmdID>
<Data>206</Data>
<Item>
<Source>
<LocURI>Contacts</LocURI>
</Source>
<Meta>
<Type xmlns='syncml:metinf'>text/x-vcard</Type>
</Meta>
</Item>
</Alert>
<Alert>
<CmdID>2</CmdID>
<Data>206</Data>
<Item>
<Source>
<LocURI>Events</LocURI>
</Source>
<Meta>
<Type xmlns='syncml:metinf'>text/x-vcalendar</Type>
</Meta>
</Item>
</Alert>
<Alert>
<CmdID>3</CmdID>
<Data>206</Data>
<Item>
<Source>
<LocURI>Notes</LocURI>
</Source>
<Meta>
<Type xmlns='syncml:metinf'>text/plain</Type>
</Meta>
</Item>
</Alert>
<Final/>
</SyncBody>
</SyncML>
Example 2.
<?xml version="1.0"?>
<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.1//EN" "http://www.syncml.org/docs/syncml_represent_v11_20020213.dtd">
<SyncML xmlns="syncml:SYNCML1.1">
<SyncHdr>
<VerDTD>
1.1
</VerDTD>
<VerProto>
SyncML/1.1
</VerProto>
<SessionID>
10
</SessionID>
<MsgID>
1
</MsgID>
<Target>
<LocURI>
GSM Remote ML
</LocURI>
</Target>
<Source>
<LocURI>
IMEI:352505003019058
</LocURI>
</Source>
<Meta>
<MaxMsgSize xmlns="syncml:metinf">
3584
</MaxMsgSize>
</Meta>
</SyncHdr>
<SyncBody>
<Status>
<CmdID>
1
</CmdID>
<MsgRef>
1
</MsgRef>
<CmdRef>
0
</CmdRef>
<Cmd>
SyncHdr
</Cmd>
<TargetRef>
IMEI:352505003019058
</TargetRef>
<SourceRef>
GSM Remote ML
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
2
</CmdID>
<MsgRef>
1
</MsgRef>
<CmdRef>
1
</CmdRef>
<Cmd>
Alert
</Cmd>
<SourceRef>
Contacts
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
3
</CmdID>
<MsgRef>
1
</MsgRef>
<CmdRef>
2
</CmdRef>
<Cmd>
Alert
</Cmd>
<SourceRef>
Events
</SourceRef>
<Data>
200
</Data>
</Status>
<Status>
<CmdID>
4
</CmdID>
<MsgRef>
1
</MsgRef>
<CmdRef>
3
</CmdRef>
<Cmd>
Alert
</Cmd>
<SourceRef>
Notes
</SourceRef>
<Data>
200
</Data>
</Status>
<Alert>
<CmdID>
5
</CmdID>
<Data>
201
</Data>
<Item>
<Target>
<LocURI>
Contacts
</LocURI>
</Target>
<Source>
<LocURI>
/telecom/pb.vcf
</LocURI>
</Source>
<Meta>
<Anchor xmlns="syncml:metinf">
<Last>
0
</Last>
<Next>
15
</Next>
</Anchor>
</Meta>
</Item>
</Alert>
<Alert>
<CmdID>
6
</CmdID>
<Data>
201
</Data>
<Item>
<Target>
<LocURI>
Events
</LocURI>
</Target>
<Source>
<LocURI>
/telecom/cal.vcs
</LocURI>
</Source>
<Meta>
<Anchor xmlns="syncml:metinf">
<Last>
0
</Last>
<Next>
0
</Next>
</Anchor>
</Meta>
</Item>
</Alert>
<Alert>
<CmdID>
7
</CmdID>
<Data>
201
</Data>
<Item>
<Target>
<LocURI>
Notes
</LocURI>
</Target>
<Source>
<LocURI>
/telecom/note.txt
</LocURI>
</Source>
<Meta>
<Anchor xmlns="syncml:metinf">
<Last>
0
</Last>
<Next>
0
</Next>
</Anchor>
</Meta>
</Item>
</Alert>
<Put>
<CmdID>
8
</CmdID>
<Item>
<Source>
<LocURI>
./devinf11
</LocURI>
</Source>
<Meta>
<Type xmlns="syncml:metinf">
application/vnd.syncml-devinf+xml
</Type>
</Meta>
<Data>
<DevInf xmlns="syncml:devinf">
<VerDTD>
1.1
</VerDTD>
<Man>
Nokia Corporation
</Man>
<Mod>
Nokia 6820
</Mod>
<FwV>
V 3.70
</FwV>
<SwV>
V 3.70
</SwV>
<HwV>
1701
</HwV>
<DevID>
IMEI:352505003019058
</DevID>
<DevTyp>
phone
</DevTyp>
<DataStore>
<SourceRef>
/telecom/pb.vcf
</SourceRef>
<MaxGUIDSize>
8
</MaxGUIDSize>
<Rx-Pref>
<CTType>
text/x-vcard
</CTType>
<VerCT>
2.1
</VerCT>
</Rx-Pref>
<Tx-Pref>
<CTType>
text/x-vcard
</CTType>
<VerCT>
2.1
</VerCT>
</Tx-Pref>
<SyncCap>
<SyncType>
1
</SyncType>
<SyncType>
2
</SyncType>
<SyncType>
7
</SyncType>
</SyncCap>
</DataStore>
<DataStore>
<SourceRef>
/telecom/cal.vcs
</SourceRef>
<MaxGUIDSize>
8
</MaxGUIDSize>
<Rx-Pref>
<CTType>
text/x-vcalendar
</CTType>
<VerCT>
1.0
</VerCT>
</Rx-Pref>
<Tx-Pref>
<CTType>
text/x-vcalendar
</CTType>
<VerCT>
1.0
</VerCT>
</Tx-Pref>
<SyncCap>
<SyncType>
1
</SyncType>
<SyncType>
2
</SyncType>
<SyncType>
7
</SyncType>
</SyncCap>
</DataStore>
<DataStore>
<SourceRef>
/telecom/note.txt
</SourceRef>
<MaxGUIDSize>
8
</MaxGUIDSize>
<Rx-Pref>
<CTType>
text/plain
</CTType>
<VerCT>
</VerCT>
</Rx-Pref>
<Tx-Pref>
<CTType>
text/plain
</CTType>
<VerCT>
</VerCT>
</Tx-Pref>
<SyncCap>
<SyncType>
1
</SyncType>
<SyncType>
2
</SyncType>
<SyncType>
7
</SyncType>
</SyncCap>
</DataStore>
<CTCap>
<CTType>
text/x-vcard
</CTType>
<PropName>
BEGIN
</PropName>
<ValEnum>
VCARD
</ValEnum>
<PropName>
VERSION
</PropName>
<ValEnum>
2.1
</ValEnum>
<PropName>
END
</PropName>
<ValEnum>
VCARD
</ValEnum>
<PropName>
N
</PropName>
<PropName>
TEL
</PropName>
<ParamName>
PREF
</ParamName>
<ParamName>
WORK
</ParamName>
<ParamName>
HOME
</ParamName>
<ParamName>
VOICE
</ParamName>
<ParamName>
FAX
</ParamName>
<ParamName>
CELL
</ParamName>
<PropName>
NOTE
</PropName>
<PropName>
URL
</PropName>
<PropName>
EMAIL
</PropName>
<PropName>
LABEL
</PropName>
</CTCap>
<CTCap>
<CTType>
text/x-vcalendar
</CTType>
<PropName>
BEGIN
</PropName>
<ValEnum>
VCALENDAR
</ValEnum>
<ValEnum>
VEVENT
</ValEnum>
<ValEnum>
VTODO
</ValEnum>
<PropName>
VERSION
</PropName>
<ValEnum>
1.0
</ValEnum>
<PropName>
END
</PropName>
<ValEnum>
VCALENDAR
</ValEnum>
<ValEnum>
VEVENT
</ValEnum>
<ValEnum>
VTODO
</ValEnum>
<PropName>
DTSTART
</PropName>
<DataType>
datetime
</DataType>
<PropName>
DTEND
</PropName>
<DataType>
datetime
</DataType>
<PropName>
SUMMARY
</PropName>
<PropName>
DUE
</PropName>
<PropName>
AALARM
</PropName>
<DataType>
datetime
</DataType>
<PropName>
DALARM
</PropName>
<DataType>
datetime
</DataType>
<PropName>
RRULE
</PropName>
<PropName>
CATEGORIES
</PropName>
<PropName>
LOCATION
</PropName>
<PropName>
STATUS
</PropName>
<PropName>
PRIORITY
</PropName>
</CTCap>
<CTCap>
<CTType>
text/plain
</CTType>
<PropName>
</PropName>
<DataType>
chr
</DataType>
<Size>
3000
</Size>
</CTCap>
</DevInf>
</Data>
</Item>
</Put>
<Final>
</Final>
</SyncBody>
</SyncML>
Best Regards
Darren.
|
|
|
|
|
Dazzer
My previous stataement about the Nokia 6600 using a public identifier of &H53 was incorrect. The WBXML sent from the 6600 does correctly use the public identifier of &HFD3.
I am not a VB programmer, (C#) and there are somethings which I think could be handled more easily and which are causing error. For example I have had to change Decode_Unsigned_Integer_Variable so that it does the following
'check the MSB
Dim val As Byte = Convert.ToByte(Convert.ToChar(Mid(VariableString, packet_pointer, 1)))
MSB = CInt((val And BitMask_7) / BitMask_7)
I think things would be much simpler if you used an array of bytes rather than a string when parsing the incomming document.
Hope this makes sense.
James
|
|
|
|
|