您的位置:首页 > 其它

How to code a WAP Push message over SMS

2013-08-27 12:41 507 查看
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.

WAP-167 Service Indication

<?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.

WBXML

0x02WBXML version 1.1
0x05public identifier for SI 1.0
0x04charset iso-8859-1
0x00length of string table
0x45si with content
0xC6indication with content and attributes
0x0Dtoken for "href=http://www."
0x03inline string follows
....the string "it.kth.se/courses/2g1722/push.wml"
0x00end of string
0x01end of indication attributes
0x03inline string follows
....the string "2G1722"
0x01end of indication
0x01end of si
Strings are coded in 8-bit octets, nothing funny here.


A WSP push

We now have to construct a WSP Push message.

WAP-251 PushMessage
WAP-230 WSP
WSP content type

0x01push transaction id, could be anything
0x06WSP type is Push
0x08header length
0x01content type length
0xAEcontent type: application/vnd.wap.sic
0xAFheader: x-wap-application-id
0x822 - the WML User Agent
0xB4header:push-flag
0x85101 - 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.

WAP-259 WDP
GSM 03.40

0x0BUser Data Header length (not including this byte)
0x05identifer elements, port addressing
0x04length of element
0x0B84push dest port (2948)
0x23F0push originator port (9200)
0x00concatenated short message
0x03
length of element
0x01ref number
0x01max number of segments
0x01current 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.

0x41A SMS-SUBMIT message with a User Header
0x00This is the message reference but here we let the phone set it.
0x0BLength of the address, change this if you change the receiver number
0x91The address type used, in this case international starting with country code
XXXXXXXXXXXThis is the phone number, check the SMS tutorial.
0x00Protocol identifier.
0x04Data 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: