So far as I know-Part I: sending a WAP PUSH message via smpp/CMPP (on)

Source: Internet
Author: User

The last word-busy ......

I have four things to do recently: 1. I was seconded by a company to help complete a POC project; 2. I want to translate a book first; 3. Continue to care about the company's projects; 4. Prepare to go home. Today I only talk about technology, so I am only going to talk about the first thing.

In the POC project I recently helped, I am responsible for mobile, for a simple reason: 1. What our company is doing now is smart phone. net CF development; 2. I have been working in this area for a long time; 3. jgtm thinks this is also a training opportunity for me (this is also my requirement ). So I came to the POC project team.

In fact, I was very worried before coming, because I heard that what I want to do is actually send a wappush package module on the PC and some ASP for PPC-phone edition.. NET page. I have never touched on wappush before, and I have no experience with ASP. NET. It can be said that it is no worse to catch one in the blog source than I do. However, I think it is a good thing to accept new challenges and let myself grow. In addition, jgtm promised to provide technical support in the future, so I made a full promise.

This project has been in progress for more than a week. At least I have been working in this project group for so long, and during this time I dare not say how many things I have learned, but at least I have experienced a lot. For example, writing a wappush packet to access the mobile gateway without enough information can be a headache. Search for wap push on Google and add other keywords. There are only a few useful Chinese materials that can be found, the most useful of which is the number. Even the "most useful" is just an example. There is not much explanation. If it succeeds, it will be crazy if it fails. Unfortunately, I encountered a situation where "the phone was successful or failed, but the phone was not successful after a while, the SIM card is successful ......". There won't be too many useful English documents. It's strange why there is no newer specification. Maybe I haven't found it. If you are also a sender of the wap push gateway, you can search for "wap push ota protocol specification" and "wbxml specification" on Google ", you can find some valuable information, and these documents will be connected to other specification, which can help you understand the entire knowledge of wap push. If you want to have a quick understanding of wap push, the following brief introduction may be helpful.

In fact, there are two ways to send wap push: One is through the PAP protocol and the other is through the smpp protocol. Smpp is a basic protocol. In China, there are three derived protocols: CMPP of China Mobile, SGIP of China Unicom (etip on CDMA), and smgp of PHS. It is said that China Mobile did not open the PAP protocol on the public network, so it had to use the CMPP protocol for wap push and sending. I don't know if other operators are doing the same. The Protocols mentioned above are public and can be obtained through Google search. It doesn't make sense to get the protocol, because you also need to know the IP and port of the wap push gateway, and the account and password that the carrier has issued to you. The biggest headache is that when you study the downloaded protocol, you may encounter at least the following major problems:

1. The agreement may be incorrect.

2. The Agreement content is not detailed or has Ambiguity

3. No actual examples

It would be better if you enter the operator's lab because you can get some technical support. However, you may encounter the following problems:

1. The operator is not clear about the technical details of the Protocol, because it is actually developed by the operator's Hardware provider (at least I see it)

2. the technical staff of the hardware provider may not be clear about the technical details of these damn protocols.

3. technical staff in the lab can help you capture at least one package and point out what is the difference between your package and the standard package. If there is no big difference, the technicians will be powerless.

During the development of wap push, I chatted with the technical staff in the lab. It is said that when other staff were connected, they also encountered the problem that the verification failed due to the nonstandard MD5 algorithm. Thanks to the. net I used, this problem will not occur. Otherwise, if the verification fails, you do not know whether the plaintext format is incorrect or what other problems are involved. In short, debugging is impossible. The problem I encountered was mainly caused by confusing documents. For example, the Protocol contains a field called sourceaddress, which actually requires you to enter the spid, the sourceid field requires you to enter sourceaddress. After reading the pile of documents, my brain will almost be blurred. I hope you will be better.

In fact, this CMPP protocol is used to send short messages, including common short messages, MMS, and wappush. Set the messagetype field and messagecontent field to specify the type of message you want to send. Therefore, if you want to send multimedia messages, you have to find information related to the MMS, especially the data packet structure. I was very depressed and found that there was very little information about wappush packets, which was untrustworthy. The previous Chinese Document helped me understand at least part of the content after comparing the other data packet captured by the lab, and the phone of a certain brand can receive it. However, what is the meaning of wappush header1 and How to Write Other tags.

Goo has been familiar with it for half a day. The content sent by the wappush package is actually the same as the XML sent by PAP, but it is compressed. The compressed format is wbxml, which uses code to represent some tags. For example, the value 0x01 indicates that the previous Tag ends (</xxx> ). However, wbxml scaling labels are divided into two parts: one is that all types of XML are common, and the other is that different types of XML have different interpretations. The spec of wbxml only mentions:

2 "-// wapforum // dtd wml 1.0 // en" (WML 1.0)

3 "-// wapforum // dtd wta 1.0 // en" (WTA event 1.0)

4 "-// wapforum // dtd wml 1.1 // en" (WML 1.1)

These three types, and what we do with wappush is

5 "-// wapforum // DTD Si 1.0 // en

I cannot find any information about the content. Even here, we only understand the content behind the header, while the content in messagecontent needs

0b05040b8423f4153030101 'wap push header 1

29060603ae81ea8dca 'wap push header 2


Sending starts here, but what are these? I don't know. I will wait for the experts to answer this question. However, here I can provide another set of valid WAP PUSH headers:

// 0x06, 0x05, 0x04, 0x0b, 0x84, 0x23, 0xf0, 'wap push header 1

// 0x25, 0x06, 0x01, 0xae, 'wap push header 2

In addition, I will also provide a messagecontent structure for my successful experiment (at least on soio t618:

// Part 1 wappushheader1:

Static private readonly byte [] wappushheader1 = new byte []

{

// 0x06, 0x05, 0x04, 0x0b, 0x84, 0x23, 0xf0,

0x0b, 0x05, 0x04, 0x0b, 0x84, 0x23, 0xf0, 0x00, 0x03, 0x03, 0x01, 0x01,

};

// Part 2 wappushheader2:

Static private readonly byte [] wappushheader2 = new byte []

{

// 0x25, 0x06, 0x01, 0xae,

0x29, 0x06, 0x06, 0x03, 0xae, 0x81, 0xea, 0x8d, 0xca,

};

// Part 3 wappushindicator (and some other things ):

Static private readonly byte [] wappushindicator = new byte []

{

0x02, 0x05, 0x6a, 0x00, 0x45, 0xc6, 0x0c, 0x03,

};

// The fourth part is the URL of A utf8-encoded wappush connection,

// After receiving the text message, the user clicks a button such as "Download" or "connection,

// It will be forwarded to this address.

// Note that you need to remove "http: //" from the URL address,

// Because the second-to-last 0x0c of wappushindicator above is href = "http ://"

// Part 5 wap push display text header:

// 0x00 indicates the ending mark of the wappushurl text above.

// 0x01 is the ending character of the <indication> sign (0xc6, the last third of indicator ).

// </Indication>

Static private readonly byte [] wappushdisplaytextheader = new byte []

{

0x00, 0x01, 0x03,

};

// The sixth part is a UTF-8-encoded message text that is displayed after the user receives the message.

// The seventh part is the message end part, 0x00 is the end part of the message text, and the last two are the terminator of some of the above signs.

Static private readonly byte [] endofwappush = new byte []

{

0x00, 0x01, 0x01,

};

Combine these parts in order, that is, the content of messagecontent.

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.