Wap push parsing (2) -- WSP and wbxml Encoding

Source: Internet
Author: User

Tian haili @ csdn

2012-06-30

 

The wap push Service is carried on the SMS service, that is, the wap push data is encapsulated in the userdata of the sms pdu. This article analyzes the WSP and wbxml codes of wap push in userdata of PDU.

 

This article uses wap push parsing (1) -- sms pdu encoding to explain the WSP and wbxml encoding of wap push data encapsulated by sms pdu as an example. Sms pdu are encapsulated outside WSP and wbxml, so the WSP and wbxml encoding does not consider whether the data is a spliced long text message, WSP and wbxml need to parse the complete userdata of the sms pdu (if multiple SMS messages are sent, this is after splicing.

79 06 01 ae 02056a0045c6080c03662e31303038362e636e2f662f736a6678000103e689bee69c8be58f8be38081e69fa5e5a4a9e6b094e38081e79c8be5b08fe8afb4e38081e79c8be696b0e997bbe280a6e6898be69cbae9a39ee4bfa1efbc8ce7ae80e58d95e4bda0e79a84e7949fe6b4bbefbc81e8b5b6e5bfabe4b88be8bdbde4bd93e9aa8ce6898be69cbae9a39ee4bfa1000101

I. WSP

Below is the per-time parsing WSP Encapsulation

 
1. transactionid: 0x79 2. pdutype: 06 06 pdu_type_push 07 pdu_type_confirmed_push 3. headerlength: the length of the header is longer: 32 bits indicates the 7-bit encoding. Up to five octets are used to encode the bit7 value of octet. 1 indicates that the subsequent octet is still the length data; the length of the 0 mark ends. Here 01 is the length of the header. 4. contenttype: (wap-230-wsp-20010705-a section 8.4.2.24) wap push is a common saying, in fact, wap push is not the final business, the final business is the business identified in contenttype. AE & 0x80-> 2E 0x2e content_type_ B _push_si "application/vnd. WAP. sic "0x30 content_type_ B _push_sl" application/vnd. WAP. SLC "0x32 content_type_ B _push_co" application/vnd. WAP. COC "0x3e content_type_ B _mms" application/vnd. WAP. MMS-message "0x44 content_type_ B _push_syncml_noti" application/vnd. syncML. notification, we can see that push service indication (Si)/push sService load (SL)/MMS are all wap push over services in SMS, while Generally, the wap push Service refers to Si/SL. Si is encapsulated here.

 

The following is the SI data encapsulated by wbxml.

 
02056a 00 45c6 08 0c 03662e31303038362e636e2f662f736a6678000103e689bee69c8be58f8be38081e69fa5e5a4a9e6b094e38081e79c8be5b08fe8afb4e38081e79c8be696b0e997bbe280a6e6898be69cbae9a39ee4bfa1efbc8ce7ae80e58d95e4bda0e79a84e7949fe6b4bbefbc81e8b5b6e5bfabe4b88be8bdbde4bd93e9aa8ce6898be69cbae9a39ee4bfa100 0101

Ii. Push Si encapsulation wbxml

Wap push Si is encapsulated in XML format, but XML is not suitable for transmission methods with extremely limited length such as SMS. Therefore, wbxml (WAP binary XML) is used for push encapsulation. Wbxml uses a byte to replace common tags and attributes, which greatly reduces the amount of data transmitted.

 

Below is the parsing from wbxml to XML:

 
02 <? XML version = "1.0" encoding = "UTF-8"?> 05 <! Doctype Si public "-// wapforum // DTD Si 1.0 // en" http://www.wapforum.org/DTD/si.dtd "> 6a ianacharset 04 iso-8859-1 17 shift_jis 6a UTF-8 03 US-ASCII 00 string table length 45 <si> C6 <indication 08 action = "signal-high" 06 action = "signal-low" 07 action = "signal-medium" 0C href = "http: // 0d href = "http: // www. 0e href = "https: // 0f href =" https: // www. 03 start of inline string value 662e31303038362e636e2f6 62f736a6678 F. 1 0 0 8 6. C n/f/s j f x 00 end of inline string value 01 '> 'end of attributes> 03 start of inline string value e689bee69c8be58f8be%81e69fa5e5a4a9 find friends, search for neighborhood, read novels reading news... Mobile e9a39ee4bfa1efbc8ce7ae80e58d95e4bda0 Feixin, simple life of your e79a84e7949fe6b4bbefbc81e8b5b6e5bfab! Hurry up, e4b88be8bdbde4bd93e9aa8ce6898be69cba download experience mobile phone e9a39ee4bfa1 fetion 00 end of inline string value 01 </indication> 01 </Si>

 
The final XML parsed is:
 
<? XML version = "1.0" encoding = "UTF-8"?> <! Doctype Si public "-// wapforum // DTD Si 1.0 // en" "http://www.wapforum.org/DTD/si.dtd"> <si> <indication action = "signal-high" href = "http://f.10086.cn % 2ff % 2 fsjfx "> finding friends, checking weather, reading novels, and reading news... Mobile phone Feixin, simple life! Download and experience mobile phone fetion </indication> </Si>

 

Iii. wbxml with string table

Wbxml encapsulates two types of strings: inline string and string table, both of which end with '\ 0. The string table can end with '\ 0'. The length of the stringtable includes the terminator' \ 0', which is the total length of all strings.

The wap push notification in the 139 mailbox uses string tables. Although many mobile terminals can receive common push messages, they cannot receive wap push notifications from 139 mailboxes, because they do not support parsing wbxml with stringtable, this push message is ignored.

Below is the wap push si data with string table

 
02056a0fe982aee4bbb63a52653a507573680045c60c03792e31303038362e636e2f693f663d343026693d313039383830393834303100080183000101

 

Below is the parsing from wbxml to XML:

 
02 <? XML version = "1.0" encoding = "UTF-8"?> 05 <! Doctype Si public "-// wapforum // DTD Si 1.0 // en" http://www.wapforum.org/DTD/si.dtd "> 6a ianacharset 04 iso-8859-1 17 shift_jis 6a UTF-8 03 US-ASCII 0f string table length is in string table length of all strings, the length contains the terminator '\ 0 '. E982aee4bbb63a52653a50757368 Email: Re: Push 00 end of string table value 45 <si> C6 <indication 0C href = "http: // 03 start of inline string value policy.10086.cn/I? F = 40 & I = 10988098401 00 end of inline string value 08 action Attribute-signal high action = "signal-high" 01 '> 'end of attributes> 83 string table reference below 00 string table index 01 </indication> 01 </Si>

 
Replace the content in the string table to get the final parsed XML:
 
<? XML version = "1.0" encoding = "UTF-8"?> <! Doctype Si public "-// wapforum // DTD Si 1.0 // en" "http://www.wapforum.org/DTD/si.dtd"> <si> <indication href = "http://y.10086.cn/I? F = 40 & I = 10988098401 "Action =" signal-high "> Email: Re: Push </indication> </Si>

 

Iv. Summary

This article uses wap push Service indication as an example to explain the WSP encoding and wbxml encoding of wap push. The two types of string-inline string and string table in wbxml are described in detail.

 

References

1. WAP binary xmlcontent format

Wbxml standard. required!

2. miui Rom receives the patch of WAP PUSH SMS

The wap push parsing implementation on Android has the source code, but the parsing is incomplete.

3. wap push over sms

Overview of wap push over sms)

4. wap push sms Encoding

Wap push Service indication encapsulation instance (English)

5. Sending sms wap push messages using the activexperts SMS and MMS Toolkit

The tool that sends wap push. Is the usage instructions, although there is no implementation details, but you can refer to wbxml token and attribute comparison. (English)

6. Implement the android wap push Function

Negative textbook. Parsing with a fixed location, and fixed with 000103 to identify the end of the URL, fixed with 000101 to identify the end of the content, is simply nonsense!

The protocol should be resolved in accordance with standards! You can use your own situation to understand the Protocol. However, to achieve this, you can only parse one situation. If the parsed content or format is slightly changed, the implementation will be useless, bugs are everywhere.

[Modify history]

Modified the page layout

  1. Put the PDU data and encoding parsing part in the csdn editing tool "Programming Language (other)", which looks much better on the section, but the color annotation is lost!
  2. Put the parsed XML in the csdn editing tool "Programming Language (HTML/XML.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.