Communicate with j2ee

Source: Internet
Author: User

<1> MIDP supports Http1.1 and uses Get and Post to communicate with the network to generate Http headers and data. To clear the packets, the http request should contain the content-type attribute.

 

<2>: connection principle between j2ee and j2ee

 

 

 

Explanation:

 

On the client, your mobile phone needs to be connected to the Internet. You can use GPRS, Wi-Fi, or 3G networks. You only need to download the client's MIDlet program (such as using OTA technology, after being installed on a mobile phone, you can connect to the server and send access requests. The Web server uses the Servlet container to process client connections and requests, and then sends these requests to the enterprise-level server, the enterprise-level server uses ejbs for sessions, Processes requests, and connects to the database system through JDBC. The database system sends the generated query result dataset back to the enterprise-level server based on SQL query statements; the enterprise-level server submits the received information to the Web server, and the Web server returns the information to the client through HTTP. Finally, the client's MIDlet displays the query result on the user's mobile phone screen. All accesses do not directly access background application resources and data resources, but access through the middle layer. This ensures the security of Background Data, in addition, the system performance and transaction consistency can be ensured through the scheduling of the middle layer.

 

 

 

<3>: Two Methods for j2-based networking (1) cmnet (2): cmwap:

 

(1) There is no difference between cmnet and computer networking. You can use the following code to get it done.

 

Try {

Http = (HttpConnection) Connector. open (url );

} Catch (IOException e ){

E. printStackTrace ();

}

 

(2) cmwap networking:

 

For some models, you cannot directly connect to the network, because your machine does not support the cmnet connection method.

 

You may find that the direct connection method can also run on some cmwap devices (only mobile phones supporting cmwap are mostly low-end mobile phones) without modification,

This is because some conversions are performed at the underlying layer. If there is no conversion, you must manually convert it.

 

Assume that the page you originally requested is: htpp: // www.testwap.com/test/try.jsp

Then you will use this sentence to connect

HttpConnection httpConnection = (HttpConnection) Connector. open ("http://www.testwap.com/test/try.jsp ");

 

However, you must write this statement to convert it into a CNWAP form.

HttpConnection httpConnection = (HttpConnection) Connector. open ("http: // 10.0.0.172: 80/test/try. jsp ");

Write again

HttpConnection. setRequestProperty ("X-Online-Hostwww.testwap.com ");

HttpConnection. setRequestProperty ("Accept ","*/*");

So OK.

 

 

The analysis may be as follows.

1. Mobile may open almost all protocols to CNNET. For example, (Socket, Http) and all ports.

2. For CNWAP, I estimate that only the http protocol and port 80 are enabled, and all others are closed. That is, CNWAP can only access the http protocol.

Because the IP address I tested is tested, it can be found directly. I did not test for non-IP addresses. Maybe CNWAP cannot explain the domain name. I don't know that.

 

 

 

 

 

 

 

 

 

 

 

 

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.