Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
SyncML
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Internals== SyncML works by exchanging [[Command-line interface|commands]], which can be requests and responses. As an example: * the [[mobile phone]] sends an <code>Alert</code> command for signaling the wish to begin a refresh-only [[synchronization]] * the [[computer]] responds with a <code>Status</code> command for accepting the request * the phone sends one or more <code>Sync</code> command containing an Add sub-command for each item (e.g., [[phonebook]] entry); if the number of entries is large, it does not include the <Final/> tag; * in the latter case, the computer requests to continue with an appropriate <code>Alert</code> message, and the mobile sends another chunk of items; otherwise, the computer confirms it received all data with a <code>Status</code> command Commands (<code>Alert</code>, <code>Sync</code>, <code>Status</code>, etc.) are grouped into messages. Each message and each of its commands has an identifier, so that the pair (MsgID, CmdID) uniquely determines a command. Responses like <code>Status</code> commands include the pair identifying the command they are responding to. Before commands, messages contain a header specifying various data regarding the [[Database transaction|transaction]]. An example message containing the <code>Alert</code> command for begin a refresh synchronization, like in the previous example, is: <syntaxhighlight lang="xml"> <?xml version="1.0"?> <!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_RepPro_DTD-V1_2.dtd"> <SyncML xmlns="SYNCML:SYNCML1.2"> <SyncHdr> <VerDTD>1.1</VerDTD> <VerProto>SyncML/1.1</VerProto> <SessionID>1</SessionID> <MsgID>1</MsgID> <Target><LocURI>PC Suite</LocURI></Target> <Source><LocURI>IMEI:3405623856456</LocURI></Source> <Meta><MaxMsgSize xmlns="syncml:metinf">8000</MaxMsgSize></Meta> </SyncHdr> <SyncBody> <Alert> <CmdID>1</CmdID> <Data>203</Data> <!-- 203 = mobile signals a refresh from it to computer --> <Item> <Target><LocURI>Events</LocURI></Target> <Source><LocURI>/telecom/cal.vcs</LocURI></Source> <Meta><Anchor xmlns="syncml:metinf"><Last>42</Last><Next>42</Next></Anchor></Meta> </Item> </Alert> <Final/> </SyncBody> </SyncML> </syntaxhighlight> The response from the [[computer]] could be an [[XML]] document like (comments added for the sake of explanation): <syntaxhighlight lang="xml"> <?xml version="1.0"?> <!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_RepPro_DTD-V1_2.dtd"> <SyncML> <SyncHdr> <VerDTD>1.1</VerDTD> <VerProto>SyncML/1.1</VerProto> <SessionID>1</SessionID> <MsgID>1</MsgID> <Target><LocURI>IMEI:3405623856456</LocURI></Target> <Source><LocURI>PC Suite</LocURI></Source> </SyncHdr> <SyncBody> <!-- accept the header of the last message from the client --> <Status> <CmdID>1</CmdID> <MsgRef>1</MsgRef> <CmdRef>0</CmdRef> <!-- 0 = header of the message --> <Cmd>SyncHdr</Cmd> <TargetRef>PC Suite</TargetRef> <SourceRef>IMEI:3405623856456</SourceRef> <Data>200</Data> <!-- 200 = ok, accepted --> </Status> <!-- accept the request of the mobile for a sync --> <Status> <CmdID>2</CmdID> <!-- this is command #2 --> <MsgRef>1</MsgRef> <CmdRef>1</CmdRef> <!-- it respond to command msg=1,cmd=1 --> <Cmd>Alert</Cmd> <TargetRef>Events</TargetRef> <SourceRef>/telecom/cal.vcs</SourceRef> <Meta><Anchor xmlns="syncml:metinf"><Next>0</Next><Last>0</Last></Anchor></Meta> <Data>200</Data> <!-- 200 = ok, accepted --> </Status> <Final/> </SyncBody> </SyncML> </syntaxhighlight> The transaction then proceeds with a message from the mobile containing the <code>Sync</code> command, and so on. This example is a refresh where the mobile sends all its data to the computer and nothing in the other way around. Different codes in the initial <code>Alert</code> command can be used to initiate other kinds of synchronizations. For example, in a "[[Two-way communication|two-way]] sync", only the changes from the last [[synchronization]] are sent to the [[computer]], which does the same. The <code>Last</code> and <code>Next</code> tags are used to keep track of a possible loss of sync. <code>Last</code> represents the time of the last operation of synchronization, as measured by each device. For example, a [[Mobile phone|mobile]] may use progressive numbers (<code>1</code>, <code>2</code>, <code>3</code>, ...) to represent time, while the computer uses strings like "<code>20140112T213401Z</code>". <code>Next</code> is the current time in the same representation. This latter data is stored and then compared with <code>Last</code> in the next synchronization. Any difference indicates a loss of sync. Appropriate actions involving sending all data can be then taken to put the devices back in sync. Anchors are only used to detect a loss of sync; they do not indicate which data is to be sent. Apart from the loss-of-synchronization situation, in a normal (non-refresh) synchronization, each device sends a [[Logbook|log]] of changes since the last synchronization.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)