330 likes | 397 Views
WAP, WML. Felhasznált források: Developer ’s Guide v1.2 (Nokia WAP Toolkit) WML Reference v1.1. WAP network protocol structure. The WAP is similar to a Web model, and operates as follows: 1 The user presses a phone key that has an URL request assigned to it.
E N D
WAP, WML Felhasznált források: • Developer’s Guide v1.2 (Nokia WAP Toolkit) • WML Reference v1.1
WAP network protocol structure The WAP is similar to a Web model, and operates as follows: 1 The user presses a phone key that has an URL request assigned to it. 2 The user agent sends an URL request to a WAP gateway using the WAP protocol. 3 The WAP gateway create an conventional HTTP request for the specified URL and sends it to the web server. 4 The HTTP request is processed by the web server. The URL may refer to a static file or to a CGI or other script application. In the first case, the web server fetches the file and adds an HTTP header to it. If the URL specifies a script application, the web server runs the application. 5 The web server returns the WML deck with the added HTTP header or the WML output from the CGI or other script application. 6 The WAP gateway verifies the HTTP header and the WML content and encodes them to binary form. The gateway then creates a WAP response containing the WML and sends it to the user agent. 7 The user agent receives the WAP response. It processes the WML response and displays the first card of the WML deck to the user. BMF-NIK Ladányi Zoltán
Content MIME type extensions Before creating your own WML and WMLScript services, configure your web server to support the following MIME types: • Content MIME type Extension • WML source text/vnd.wap.wml wml • Wireless bitmaps image/vnd.wap.wbmp wbmp • Compiled WML application/vnd.wap.wmlc wmlc • WMLScript source text/vnd.wap.wmlscript wmls • Compiled WMLScript application/vnd.wap.wmlscriptc wmlsc BMF-NIK Ladányi Zoltán
Disadvantages of HTML/HTTP/TCP • HTML content and HTTP headers are textual, their encoding is not size-optimal • TCP is too general for browsing-type applications. It sets up a two-way general stream with sequence numbers in both directions. Browsing requirement is only request-reply. It could be done with one transaction identifier and a less general protocol. • HTML is optimized for large-screen devices, it can be rendered quite inefficiently on small screens (frames) • HTML is quite complex, an acceptable browser takes a lot of application space. Characteristics of mobile network/devices • Bandwidth is restricted (9.6KBaud on GSM) • Device memory is small (2MByte total code for a 6110) • Device display is small and generally only black&white BMF-NIK Ladányi Zoltán
Expectations towards WAP • It should be traffic and size-optimized • It should use whatever mobile network we have (SMS, CDMA, IS-136 …) • It should be open standard • It should be integrated with the Internet • WAP and Internet will merge as soon as phones are powerful enough and mobile networks have sufficient capacity BMF-NIK Ladányi Zoltán
Overwiev of the WML BMF-NIK Ladányi Zoltán
WML Structure • The first line specifies the XML version number. • The second line specifies the SGML public document identifier. • The third line specifies the location of the WML document type definition (DTD). The DTD can be located in the network, or you can store it locally to make accessing it faster. The Nokia WAP Toolkit includes the DTD file wml.xml, found in the directory <installation directory>\dtd. • The fourth line is the root element of the XML document of which there may only be only one and it must match the root element name as indicated in the first argument of the document type. All WML documents must begin with a <wml> tag. • The following lines define a card containing a start and an end tag and text to be displayed to the user. • All WML decks must end with a </wml> tag.
The elements of WML • Text Formatting • Anchors, Images, Timers • Events • Tasks • Variables • User Input BMF-NIK Ladányi Zoltán
Character entities and special characters (see: specchars.wml) BMF-NIK Ladányi Zoltán
Formatting text • em Render with emphasis. • strong Render with strong emphasis. • i Render with an italic font. • b Render with a bold font. • u Render with underline. • big Render with a large font. • small Render with a small font. Use the strong and em tags where possible. It is not recommended to use the b, i and u tags except where explicit control over text presentation is required. BMF-NIK Ladányi Zoltán
Feladat • „Hello World” oldal elkészítése, formázással BMF-NIK Ladányi Zoltán
Text formatting elements • br beginning of a new line • p paragraph (see: multicard.wml) • align left, right, center • mode wrap, nowrap • table table element (see: weather.wml) • title title of table • align alignment • columns number of columns BMF-NIK Ladányi Zoltán
Feladat • Készítsen egy táblázatot, mely tartalmazza a barátai nevét, telefonszámát és e-mail címét! • Az egyes sorokat és oszlopokat különböző módokon formázza! BMF-NIK Ladányi Zoltán
Anchors, images and timers • anchor (see: readme.wml) • image (see: weather.wml) • timer (see: multicard.wml) BMF-NIK Ladányi Zoltán
Feladat • Készítsen egy deck-et, két card-dal. • Az első card-ról egy “<anchor ...” segítségével jussunk el a második card-ra • A második card-ról egy képre kattintva juthassunk vissza az első card-ra BMF-NIK Ladányi Zoltán
Tasks • go: <go href=”#help”/> • prev: <prev/> • noop: <noop/> BMF-NIK Ladányi Zoltán
Card and Deck task override • deck level: template • card level: card (see: deck2a.wml) BMF-NIK Ladányi Zoltán
Events (1/4) • do • type: accept, prev • label • name (see: deck2a.wml, deck2b.wml) BMF-NIK Ladányi Zoltán
Events (2/4) • ontimer, timer (see: multicard.wml) BMF-NIK Ladányi Zoltán
Feladat • Készítsünk egy olyan deck-et, mely 2 card-ot tartalmaz: • Az 1. card-on egy do-accept-go-val juthassunk el a 2. cardra • A 2. card-ról egy timerrel jussunk vissza az 1. card-ra BMF-NIK Ladányi Zoltán
Events (3/4) • onevent: • onenterforward onenterbackward: BMF-NIK Ladányi Zoltán
Feladat • Készítsünk egy 3 card-ból álló deck-et: • Az 1. card-on do-accept-go-val juthassunk el a 2. card-ra • A 2. card-ról egy onenterforward-dal jussunk át a 3. card-ra, egy onenterbackward-dal vissza az 1-re • A 3. card-on egy do-accept-prev-vel juthassunk el a 2. card-ra BMF-NIK Ladányi Zoltán
Events (4/4) • onpick BMF-NIK Ladányi Zoltán
Variables • Set: (go, prev, refresh) • <setvar name=”var_1” value=”007”/> • Read: • $var_1, $(var_1) (see: deck1.wml) BMF-NIK Ladányi Zoltán
Feladat • Készítsünk olyan card-ot, melyen két do-accept-go-setvar-ral egy változót módosítunk: a választástól függően vagy az „a” vagy a „b” betűt fűzzük össze a változóval BMF-NIK Ladányi Zoltán
Input elements • input • name name of the variable • value default value • type text | password • format A,a,N,X,x,M,m,*f,nf • maxlength maxiumum number of characters • size size of the input area • emptyok • title BMF-NIK Ladányi Zoltán
Feladat • Az első card-on kérjük be a felhasználó vezeték- és keresztnevét, a második card-on teljes név szerint üdvözöljük! • A card-ok közötti mozgás során hozzunk létre egy „teljes_nev” nevű változót, amibe a megadott vezeték- és keresztneveket összefűzzük! A kiiratáshoz használjuk ezt a változót! BMF-NIK Ladányi Zoltán
Select, option, optgroup elements • select (see: deck3.wml) • multiple multiple selection • name, value name & default value of the variable • iname, ivalue name & default value of the index variable • title title of select element • option • title • value • onpick • option group • title BMF-NIK Ladányi Zoltán
Feladat • Készítsünk olyan deck-et, melyen a select-option-ből kiválasztott állathoz (kutya, macska, ló) kapcsolódó card-ra juthatunk el! BMF-NIK Ladányi Zoltán