WML (Wireless Markup Language) developed to mobile phones

zhaozj2021-02-08  320

Author: Jani J vinen

Translation finishing: Cui Kai

---- As is well known, Delphi has the ability to create an HTML file. However, you know? Delphi can also be used to create a new WML file you need to have some new WAP (Wireless Application Protocol).

---- This article will learn how to create a quick, custom query system that uses a WAP phone or an analog system. Let us exceed our own, let us start from the beginning.

---- WAP is the latest protocol used by the third-generation mobile phone that supports WAP. Many people think that WAP will bring the Internet into the mobile phone, this is not completely correct; after all, we can't use WAP to implement online surf. WAP can do is nothing more than letting you retrieve and display special documents developed as WAP phones. These files are prepared using WML language.

---- WML language and HTML language is similar, although there are many formatted operations such as nested tables, layers, colors, and different print fonts, etc., these still cannot be applied to WML. But WML does allow developers to define simple text formats such as images, links, and text entered. It is only such a simple application, the key reason is on the hardware. Because the current mobile phone can't first be such a rich formatting operation. The current mobile phone is only used to display very little pixels (approximately 200 * 200), and only about 4 gray adjustments can now be displayed, and it is now possible to display colored. At this time, a new tag language is needed to do this phone application, because the current HTML file cannot be suitable for such a screen. This is the WML. Agreement.

---- WAP device is accessed by standard URL (Uniform Resource Locator, representing a representation method for specifying information locations on the Internet WWW service). When the user of the WAP device enters the URL in his WAP mobile phone or other devices, this device begins with a WAP gateway to which it serves via a radio wave.

---- One such gateway is usually replaced by a host of the mobile communication device operator, for example: mciWorldcom or Sprint (when cutting, the combination of these two companies is unreasonable, but shareholders have basically agreed ). In addition to receiving a mobile phone request, this gateway computer and turns it to the usual Internet through the HTTP protocol. Here, those devices provide a web service that responds to these requests and returns the associated WML data to this gateway computer. At this time, this gateway computer returns the corresponding WML file to the mobile phone that issues a request, and finally displays these files in front of the user of the WAP mobile phone. This is the whole process of the whole communication.

---- Note: MCIWORLDCOM and SPRINT are famous American communication companies, and in China, China Mobile Communications plays this role.

---- Since the WML file is accessed by using the HTTP protocol on the Internet, WAP technology does not require equipment providers to provide special software and hardware devices. A general web service, such as Apache and IIS (Microsoft Internet Information Server), can be configured as an appropriate WML file. Moreover, a single web service can serve both HTML and WML pages simultaneously, as web services can serve a variety of different types of files, such as GIF, JPEG, ZIP, etc. However, a separate (virtual) web service should be developed to serve the WAP service, as this makes it easier to record those URLs. Language ---- WML is a language using XML syntax. This means that WML can be written using any text editor, and even NOTEPAD can be used. Moreover, WML is similar to HTML, many WML identifiers, such as , , , and are almost identical to almost identical meaning in HTML. The following code is a WML example:

// en "" http://www.wapforum.org/dtd/wml_1.1.xml ">

Ontimer = "# login">

Ma's on-line

order query system

---- Or above is an example of using WML 1.1 version

---- There is a place where WML and HTML are: one file in WML is not called files in HTML, but called card group (deck), a card group is one or more cards (Card) )group. A card can only be displayed at a time on the WAP phone screen, and it can only display a few lines of text.

---- The current WAP phone can only handle the WML code that is less than 1k bytes at a time. Therefore, the code written with WML must be very small. And, since the number of texts displayed on the WAP phone screen is limited, each WML code must be short.

---- If the data on a WAP card is not suitable for the screen size, the user is forced to scroll through the scroll bar to see the content on the screen. Now the best WAP phone does not need an extended scroll bar, and it is adapted to the above information. Users can now browse the web in different windows throughout the screen.

---- When the user can use a general hypertext link, just like a task bar in Windows, it can use the command written in WML identifiers.

---- For example, identifier will allow users to browse the web later in the WAP device.

---- In order to use a more rich command, not just forward or backbring the web, WML can be extended into a scripting language, becoming WmlsCirpt. WMLScript is similar to JavaScirpt scripts in the HTML world. But of course, its function is still very limited, but he still meets the user's input, simple calculation, or settings for WAP browsing status. Development Tools To help users implement WAP solutions, Nokia has developed a Java-based WAP development tool. It can be used to create, test, or debug WAP devices. (Please see the picture below)

---- A WAP development tool simulates a real WAP phone and miniature browser. This development tool allows for any type of WML file from disk or INTERNER. When loading, this WAP simulation system processes the file and display it on the screen. At this time, the developer can use the button of the mobile phone to enter text, select options and positioning for WAP devices.

---- Navigation bar can be implemented by using bookmarks, this is the development tool. In fact, bookmarks are just a simple example that makes developers' work. For example: This development tool allows real-time monitoring of each variable created using WML and WMLSCIRPT languages. Just as the 'Watch' window in Delphi. Although this development tool is very limited, there is no doubt that the function of this real-time view variable makes developers to debug WML code easier.

---- Since this development tool allows developers to download any type of file in the Standard HTTP protocol, this simulation system is a powerful tool for the interactive system running on a web server. Of course, these pages can be created dynamically. Delphi5 provides good support for building a web solution through embedded WebBroker technology. Typically, WebBroker technology is used to create a dynamic HTML solution, and there are now many popular web servers. However, due to its flexibility, WebBroker technology can also be used to create WML.

---- Delphi's solution

---- Another routine that provides download: is an isapi DLL program. It can run on IIS3.0 or updated version, detail this ISAPI's DLLS file exceeds the scope of this article, but you can find more information about ISAPI on the Internet. The best source code is at http://www.delphizine.com/include/click_redir.asp?url=http://msdn.microsoft.com/. Microsoft Developer Network (MSDN). You need to view information about debug ISAPI DLLs, please visit: http://www.delphizine.com/features/2000 / 04 / di200004jj_f / di200004jj_f.asp # Sidebarone View toolbar "debugging isapi DLLS."

---- Isapi DLLS's default returned is a general HTML code, which can be manually created, or you can use the page processing control in Delphi. Of course, the biggest advantage is that Delphi allows it to be easily connected to the database, which can query data inserted into the HTML code. Our routines are really implemented, it queries a database, create a WML containing information, and returns the result of the query to the user. Directly, the routine uses the DBDemos database alias in Delphi.

---- This DBDemos database allows access to virtual users and order databases for diving equipment for maritime adventure. This routine allows WAP mobile phone users to browse a real-time order information given. The name of this routine is called: "Marine Adventure Order Online Query System", or referred to as MaoOQs (for more information on downloading, please see the detailed details end of this article). ---- Log in to the maritime adventure program

---- When you want to use maooqs, enter http: //myserver/login.wml on your WAP phone (or in WAP development tool), then the WML browser has a display "" Welcome to "screen, then there will be a login screen," Welcome to "and the login card's WML source code as follows:

Ontimer = "# login">

Ma's on-line

order query system

Enter your ID:

Format = "* n" EMPTYOK = "false" />

Enter your password:

Format = "* m" EMPTYOK = "true" />


---- The login screen includes two input fields, one is the user ID, and the other is a password. These two fields are created using the WML identifier, and the various names entered by the user are defined by the Name property. ---- identifier defines a role, which points to the DLLS of the ISAPI of the routine (indeed the provincial path is /scripts/ma_ooqs.dll). uses standard HTTP's post command to send user input data into this DLL. Note The identifier automatically indicates that the browser translates the $ (CustID) and $ (Password) variable entered by the user through the HTTP protocol.

---- When the user clicks on the login command, this WAP phone is connected to this DLL, which makes this DLL executes the login action as shown. First, the code extracts the CustID and Password fields from the request.contentFields property. After being confirmed, (also specifically a dedicated database to save this information, by traversing the database, the function of this traversal is isvalidcustid, as follows

Function TMAWebmodule.issalidCustid

(Custid, Password: String): Boolean;

Begin

DebugMessage ('isvalidcust:' # 13'custid = " Custid

# 13'password = "' password '");

Result: = FALSE;

WITH CUSTOMER Do Begin

Try

Open;

IF locate ('Custno', Custid, []) THEN

if (Customerstate.Asstring) =

Lowercase (Password)) THEN

RESULT: = TRUE;

Finally

CLOSE;

END;

END;

END;

Procedure Tmawebmodule.mawebmoduleLoginAction

Sender: TOBJECT; Request: TWEbRequest;

Response: TWebResponse; var handled: boolean;

VAR

Custid, Password: String;

Begin

Custid: = Request.contentFields.Values ​​['CustId'];

Password: = request.contentfields.values ​​['password'];

{Check Validity of CustID / Password.}

With response do begin

IF isvalidcustid (Custid, Password) THEN

Begin

DEBUGMESSAGE ('Custid / Password Is Valid.');

MaWebmoduleMainuaction (Sender, Request,

Response, Handled);

end

Else

Begin

DEBUGMESSAGE ('Invalid Custid / Password Pair.');

ContentType: = mimetypewml;

Content: = InvalidPageWML;

END;

END;

Handled: = true;

---- Since the DBDemos database does not contain real user IDs and corresponding passwords, the routine uses the CustNo field in the Customer Table Customer to do ID, using the State field to perform the corresponding password. To test this intent, you can use the following ID and password: "1221" and "hi"; "1560" and "fl"; and "1680" and "ga." Return to the WML code on the browser

---- General, WebBroker Apply returns some simple HTML code to your browser by control over the RESPONSE object in the onaction event handle. The TWEBRESPONSE class is represented by a Content property of the Response parameter, which can receive HTML code created by this event handle.

---- When the user's browser receives data, it handles it according to its MULTIPURPURPOSE Internet Mail Extensions. The MIME Type of the TWebResponse class is "text / html", which specifies the data type of the Content property, and it is true that HTML code.

--- However, the WAP application requires the MIME type "text / vnd.wap.wml" text / vnd.wap.wml of WML (Version 1.1), "therefore needs to be changed. Note that the ContentType property can be changed to any valid MIME type. For example: Changing this property is "image / gif" will allow the action to return to the image data of a bitmap (binary.gif).

---- When defining the correct MIME type, the handle of this action event will clearly set the Content property to include a valid WML code. Since each of the WML pages generated by Application requires a public head, this routine defines a name that is WmlHeader to contain this information.

---- Store data returned to the database After the user is successfully logged in, the user returns to the main menu of marine adventure. Through this menu, the user can choose to view the information of the customer or the status of the order. If the customer selects the hyperlink of user information, this defined method of the CustInfoAction method of the MAWEBModule web module will be executed.

---- First, the code returns to the CustNO parameter of the post http command, when the information of the logged in user is found in the client table, the code creates a WML code that includes three input fields. Initially, three input fields include the customer's ZIP number, city, and state, (Remember, this state is a password). Users can adjust these three fields, he can save new one by selecting the "Modify Info" command The value returns to the database. When the user selects this command, the ModifyCustAction method will be executed. (See below)

---- MAWEB module in Delphi IDE

Procedure Tmawebmodule.mawebmoduleModifyCustAction

Sender: TOBJECT; Request: TWEbRequest;

Response: TWebResponse; var handled: boolean;

Var Custid, State, City, Zip: String

Begin

Custid: = Request.contentFields.Values ​​['CustId']; state: = request.contentfields.values ​​['State'];

City: = request.contentfields.values ​​['City'];

Zip: = Request.contentFields.Values ​​['Zip'];

With response do begin

ContentType: = mimetypewml;

Try

If LocateCustomer (Custid) THEN

Begin

DebugMessage ('Saving Customer Data:' # 13

'CustId = "' Custid '" # 13

'State = "' state '" # 13

'City = "' city '" # 13

'Zip = "' zip '" # 13);

Customer.edit;

Customerstate.Asstring: = State;

CustomerCity.Asstring: = city;

Customerzip.Asstring: = zip;

Customer.post;

Content: = WMLHEADER

' CRLF

'' CRLF

'

'href = "/ scripts / ma_ooqs.dll / mainmenu">

CRLF '

'value = "' httpencode (custom) '" /> CRLF

'' CRLF ' CRLF

' CRLF '

'

CRLF ' Customer Info SuccesFully'

'modified.
crlf ' CRLF

'' CRLF CRLF '' CRLF; END

Else

Content: = InvalidPageWML;

Finally

Customer.Close;

END;

END;

Handled: = True;

END;

---- Figure 6: Stores the data entered by the user to the Customer table.

---- This code extracts new customer information from the request.contentfields property, then find the correct customer record in the Customer table, then call the Edit method to transfer this table into the Dsedit state, set the field value (fields), final Call the POST method submit record.

---- Test the Maritime Adventure Program to test this program, you need to have a web server, which can run the ISAPI system. This routine has been tested under Microsoft IIS4.0, but she should also run on other compatible products or other versions of IIS. In addition to this web server, you also need to install NOKIA WAP Toolkit Version 1. (At the time of cutting, the test version of Nokia Wap Toolkit 1.3 provides a download). This product can be downloaded from Nokia's WAP site (http://www.delphizine.com/include/click_redir.asp?url=http://www.forum.nokia.com/.) This development tool does not need to be installed On the same computer of the web server, because it is only necessary to connect to the web server via the IP network. When this WAP development tool is turned on, he will show a welcome project (see Figure 2). This development system can simulate two mobile phone modules. To implement MaoOQs, use this development tool parameter menu command to select Nokia 6110 phone.

---- To locate the login screen of this program, from the LOAD Location Command from the GO menu, type the URL of the login login.wml file: http://localhost/login.wml. Note that before doing these operations, this Login.wml files need to be copied to the root directory of the WEB server's Publish directory, and it is not necessary to say that this web server is successfully run MaoQs.

---- The figure below shows the related screens of our testing offshore adventure application. When this login.wml file is successfully logged in, you will soon see the "Welcome to" screen in step 1, after a few seconds, the screen automatically switches to Step 2, enter the text in the input field, click WAP The blue "/" symbol of the upper left corner of the phone keyboard. After the point, the lower left corner of the WAP phone screen is "Edit", if it writes "login", you need to click, the down arrow button, because it is not an editing state.

---- When the edit command is successful, the screen displays the full text input editor such as step3. The Customer ID field can only enter a number, so click the number key to enter the corresponding number. If you enter an error, "/" on the right can wipe the last character. You can enter letters and numbers in the Password field, so you can enter the corresponding Password, sometimes you may need to click the number key to enter letters, for example: If you need to enter the letter "B", you need to quickly click the button "1" two I can enter this letter attendant. If you use a mobile phone to enter text, you must know the method of this input text. ---- The picture above is the NOKIA 6110 mobile phone expanded screen, these STEP introductions In the order of the maooQs program, request data from DLL

---- When the Customer ID is successfully entered, you will find the screen in Step 2 in the screen. Wait a little waiting "login" command is activated, then click the "/" button to select the command, which will handle this login process to select the login command to connect this WAP mobile phone to the Ma_ooqs ISAPI application in the / scripts / directory of the web server. Of course, the ISAPI DLL has been placed in the / scripts / directory of the web server, and this web server has enough permissions to perform these DLLs, if each step is normal, this WAP mobile phone will Accept normal WML data returned from DLL. If you enter any of the incorrect Customer ID or Password, the screen as shown in SETP 4 is displayed, showing incorrect ID screen; normal, display the mains shown in STEP 5 menu.

---- The arrow key on the WAP mobile phone is that you can select the items in the menu command. Click the "/" button to display the screen of the user information such as STEP 6, or the screen of the order details, such as STEP 6. Press "/" again to allow you to switch between these three pages. If you use the Modify Info command in the screen in STEP 7 to change the customer's information, you will see the adjustment window as SETP 8. It is worth noting that WAP devices typically have no "log out" command because this command is not necessary. For different WAP devices, you just need to enter the URL, just as you are in the web browser.

---- to sum up

---- Now WAP is today mobile phone and


New Post(0)