WAP Push encoding - Length Quote

WAP Push encoding - Length Quote SearchSearch
Author Message
Frank Henningsen
New member
Username: Fhx

Post Number: 1
Registered: 02-2008
Posted on Thursday, February 07, 2008 - 10:09 am:   

hi all,

does anyone know how the length of the content type should be encoded for WAP push messages?

Ive succedded in sending WAP push messages to Windows Mobile devices by sending the following WAP push message:

[01] Transaction ID
[06] PDU Type PDU Type (0x06 = push)
[44] WSP Header length: 0x44 = 68

[1f] Length-Quote. Length > 30 and necessary to quote.
[2d] Length: 0x2D = 45 (includes content type and security)
[b6] WSP Content type (0x80 | 0x36 = B6) (application/vnd.wap.connectivity-wbxml)

[91] SEC (0x80 | 0x11 = 0x91)
[80] NETWPIN (0x80 | 0x00 = 0x80)
[92] MAC (0x80 | 0x12 = 0x92)
[34][41][34][37][34][42][39][45][46][31][31][46][31][32][36][45][39][34][33][44]
[32][31][36][30][39][34][45][34][46][44][38][30][31][36][35][35][32][44][34][37]
[00] EOF

[b4] Push-Flag token (0x80 | 0x34 = 0xB4)
[81] Push-Flag value (0x80 | 0x01 = 0x81) : Initiator URI is authenticated

[b1] X-WAP-Initiator-URI = "http://demo.dk/"
[68][74][74][70][3A][2F][2F][64][65][6D][6F][2E][64][6B][2F]
[00] EOF

[AF] X-WAP-APPLICATION-ID (0x80 | 0x2F = 0xAF)
[80] x-wap-application:* (0x80 | 0x00 = 0x80) ANY_APPLICATION

WSP Body
[3][b][6a][0][45][c6][0][2][5][1][c6][0][0][50][3][4d][54][0][1][87][0][2][6][0] [0][6][3][68][74][74][70][3a][2f][2f][6d][6f][62][69]

But i don´t understand why the content type length is encoded as [1f][2d][b6] since the content type value [b6] is only 1 octet long. Ive tried to encode the content type length using the short-length format as [01][b6], but this dosent work. Should the length quote value always be [1f][2d] or am i doing something wrong here?

WAP-230-WSP 8.4.2.2 defines the length as
Value-length = Short-length | (Length-quote Length)
; Value length is used to indicate the length of the value to follow
Short-length = <Any octet 0-30>
Length-quote = <Octet 31>
Length = Uintvar-integer

best regards
Frank Henningsen
deepkamal singh
New member
Username: Deepkamal

Post Number: 9
Registered: 12-2006
Posted on Wednesday, May 21, 2008 - 08:42 am:   

Hi Frank,

being unaware of all internal details, i used following way to send WAP push, and it gets delivered on every handset success fully,in very layman language let me describe it as below,

for a simple SI we have these fixed components
or constants of a push
udh = "0605040B8423F0"
tagData1 = "DC0601AE02056A0045C60C03"
tagData2 = "000103"
tagData3 = "000101"
now there are two components which you can say are variables
first is Push Title let it be 'Download ABC'
and second is Push Target Url lets take it as 'www.abc.com'

now just use any algo to convert these two in HEX,
for example u can use bin2hex() function in PHP
or file2hex.exe ,
or use following function code in VB

'=================================================

Private Function strToHex(myStr As String) As String
Dim hexStr As String
Dim hexTmp As String
Dim i%

For i = 1 To Len(myStr)
hexTmp = Hex(Asc(Mid(myStr, i, 1)))
hexStr = hexStr & hexTmp

Next

strToHex = hexStr

End Function
'=================================================

now u have push title and url converted into hex lets name them HexTitle and HexUrl

so your sms body goes like this

tagData1+HexTitle+tagData2+HexUrl+tagData3

here '+' is used to indicate concatenation ,dont use as it is,but just concatenate them.

and mention UDH as mentioned above for sms's UDH,

btw this is very basic SI, and to understand these (tagData1,tagData2 ....) u have to go through the Docs and Specs my friend,

best of luck
Deepkamal Singh
deepkamal@gmail.com
Khmer Tech
New member
Username: Khmertech

Post Number: 1
Registered: 07-2008
Posted on Friday, July 11, 2008 - 06:37 am:   

Hi;
I have this hardcode in java:
Can you pls help me to have a proper format:
...
..
ByteBuffer bSM =new ByteBuffer();
bSM.appendByte((byte)6);
bSM.appendByte((byte)5);
bSM.appendByte((byte)4);
bSM.appendShort((Short)0x0B84);//indeciate the port 2984
bSM.appendByte((Short)0x23F0);// for Org.port 2900

bSM.AppendBuffer(smData);//smData is reading from wbxml file as binnary
request.SetEsmClass((byte) (Data.SM_UDH_GSM);
request.setDataCoding((byte)0x0f5);
session.submit(request);
///////////
Once I sent; I use Wireshap; Protocol Analyzer to trace the message. But it doesn't show the WSP session in the report. But; when I use nowSMS Web Interface to send OMA XML format setting; it show :
WSP(0x06) (WBXML 1.3, Public ID: "-//WAPFORUM//DTD PROV 1.0//EB (Provisioning 1.0)"
----------
Can anyone help me on this on how to send the OTA setting properly.

A completed source code would be very appriciate.

Khmertech