Decoding a WBXML SyncML message from an S60 device

2019-03-21 22:33发布

I'm trying to decode a WBXML encoded SyncML message from a Nokia N95. My first attempt was to use the python pywbxml module which wraps calls to libwbxml. Decoding the message with this gave a lot of <unknown> tags and a big chunk of binary within a <Collection> tag. I tried running the contents of the <Collection> through by itself but it failed. Is there something I'm missing?

Also, does anyone know of a pure python implementation of a wbxml parser? Failing that a command line or online tool to decode these messages would be useful -- it would make it a lot easier for me to write my own...

3条回答
叛逆
2楼-- · 2019-03-21 23:03

I ended up writing a python parser myself. I managed to do it by following the spec here: http://www.w3.org/TR/wbxml/

And then taking the code tables from the horde.org cvs.

The open mobile alliance's site and documentation are terrible, this was a very trying project :(

查看更多
不美不萌又怎样
3楼-- · 2019-03-21 23:07

Funnily enough I've been working on the same problem. I'm about halfway through writing my own pure-Python WBXML parser, but it's not yet complete enough to be useful, and I have very little time to work on it right now.

Those <Unknown> tags might be because pywbxml / libwbxml doesn't have the right tag vocabulary loaded. WBXML represents tags by an index number to avoid transmitting the same tag name hundreds of times, and the table that maps index numbers to tag names has to be supplied separately from the WBXML document itself. From a vague glance at the libwbxml source it seems like libwbxml has a bunch of tag tables hard coded. It has tables for SyncML 1.0-1.2; I think my Nokia E71 sends SyncML 1.3 (if so, your N95 probably does too), which it looks like libwbxml doesn't support yet.

Getting it to work might be as simple as adding a SyncML 1.3 table to libwbxml. That said, last time I tried, pywbxml doesn't compile against the vanilla libwbxml source, so you have to apply some patches first... so "simple" may be a relative term.

查看更多
混吃等死
4楼-- · 2019-03-21 23:19

I used pywbxml , Just needed one patch in pywbxml.pyx:

params.lang in function wbxml2xml around line 25 set to:

params.lang = WBXML_LANG_UNKNOWN

works like charm. Also changing base class for WBXMLParseError to exception helps:

class WBXMLParseError(Exception):
查看更多
登录 后发表回答