This is a small guide in how to code a WAP Push message over SMS.
The Service indication
This is the message we want to deliver. It's a service indication message, the message will be presented to the user and if the user choose to accept the message the link to the server will be used.
<?xml version="1.0"?> <!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 1.0//EN" "http://www.wapforum.org/DTD/si.dtd"> <si> <indication href="http://www.it.kth.se/courses/2g1722/push.wml" > This is a test. </indication> </si>
In order to send this we need to code it in WBXML format. Note that the specifics of how to code a service indication element is found in the end of WAP-167.
0x02 | WBXML version 1.1 |
0x05 | public identifier for SI 1.0 |
0x04 | charset iso-8859-1 |
0x00 | length of string table |
0x45 | si with content |
0xC6 | indication with content and attributes |
0x0D | token for "href=http://www." |
0x03 | inline string follows |
.... | the string "it.kth.se/courses/2g1722/push.wml" |
0x00 | end of string |
0x01 | end of indication attributes |
0x03 | inline string follows |
.... | the string "2G1722" |
0x01 | end of indication |
0x01 | end of si |
Strings are coded in 8-bit octets, nothing funny here.
A WSP push
We now have to construct a WSP Push message.
0x01 | push transaction id, could be anything |
0x06 | WSP type is Push |
0x08 | header length |
0x01 | content type length |
0xAE | content type: application/vnd.wap.sic |
0xAF | header: x-wap-application-id |
0x82 | 2 - the WML User Agent |
0xB4 | header:push-flag |
0x85 | 101 - last-push, URI authenticated |
Note that when you look for the token values in WAP-230 you will not find "0xAE" but rather "0x2E". When coding small integers the high bit is set.
The WSP message is then put in a WDP packet that is directed to the push destination port.
The WDP
The WDP packet have different structure depending on which link layer we are using. Since we are sending it over a SMS we will code it as a User Data Header. Note that we have two elements one specifying the destination port (2948) and a second indicating that the rest a concatented message.
0x0B | User Data Header length (not including this byte) |
0x05 | identifer elements, port addressing |
0x04 | length of element |
0x0B84 | push dest port (2948) |
0x23F0 | push originator port (9200) |
0x00 | concatenated short message |
0x03 | |
length of element | |
0x01 | ref number |
0x01 | max number of segments |
0x01 | current segmenet number |
The SMS
So we now have a WDP that includes a WSP consisting of a Service indication. This should now all be put in a SMS.
0x41 | A SMS-SUBMIT message with a User Header |
0x00 | This is the message reference but here we let the phone set it. |
0x0B | Length of the address, change this if you change the receiver number |
0x91 | The address type used, in this case international starting with country code |
XXXXXXXXXXX | This is the phone number, check the SMS tutorial. |
0x00 | Protocol identifier. |
0x04 | Data coding scheme, in this case 8-bit bytes. |
0x.. | This is the length of the User Data |
The whole WDP is now interpreted as a User Header Information. If the terminal can not understand the header it will be ignored.
http://web.it.kth.se/~johanmon/attic/2g1722/laborations/push.html