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.
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
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
Strings are coded in 8-bit octets, nothing funny here.
We now have to construct a WSP Push message.
WAP-251 PushMessage
WAP-230 WSP
WSP content type
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 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
So we now have a WDP that includes a WSP consisting of a Service indication. This should now all be put in a SMS.
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
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
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 |
A WSP push
We now have to construct a WSP Push message.WAP-251 PushMessage
WAP-230 WSP
WSP content type
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 |
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 thatthe rest a concatented message.
WAP-259 WDP
GSM 03.40
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 |
http://web.it.kth.se/~johanmon/attic/2g1722/laborations/push.html
相关文章推荐
- How To Send SMS Text Message in iPhone Apps
- How to push your code in git
- [原]Wap push over sms 实践
- Create WAP Push SMS Messages (From C# to JAVA)
- How to correctly translate an error code into an error message
- ASP.NET Alerts: how to display message boxes from server-side code?
- How to Convert Temperature (K) to RGB: Algorithm and Sample Code
- [Sharepoint]How to Complete Task using code and send to next task
- How to release an unmanaged library loaded into managed .NET code
- How to get HTML code of a WebElement in Selenium
- How to solve:util.NativeCodeLoader: Unable to load native-hadoop library for your platform ??
- Rietveld, or “How to revamp your code review process”
- HOWTO: How to Use PeekMessage() Correctly in Windows
- Don't know how to iterate over supplied "items" in <forEach>
- How to Push a Program to Remote Computer?
- How to Write Maintainable Code!!
- How to tacktrace In Android for Java code
- How to generate FLEXIcontent SEF URLs in custom code
- LR:接口性能测试时提示:Code-29723 Error: Failed to deliver a p2p message from parent to child process, reason
- How To Install Visual Studio Code On Ubuntu