660 likes | 832 Views
WAP and WML. WAP. WAP = Wireless Application Protocol 웹을 통해서 무선 어플리케이션을 연결할 규약 ( 프로토콜 ). WAP 에 대한 요구. Wireless networks and phones have specific needs and requirements not addressed by existing Internet technologies WAP enables any data transport
E N D
WAP • WAP = Wireless Application Protocol • 웹을 통해서 무선 어플리케이션을 연결할 규약(프로토콜)
WAP에 대한 요구 • Wireless networks and phones • have specific needs and requirements • not addressed by existing Internet technologies • WAP enables any data transport • TCP/IP, UDP/IP, GUTS (IS-135/6), SMS, or USSD • The WAP architecture • several modular entities • together form a fully compliant Internet entity • all WML content is accessed via HTTP 1.1 requests
WAP 의 이점 • 표준 XML기술을 이용 • Content 와 airlink프로토콜사이 최적화 • The WML UI components map well onto existing mobile phone user interfaces • no re-education of the end-users • leveraging market penetration of mobile devices • WAP은 HTTP SERVER1.0 표준을 따름. • CGI, ASP, JAVA, Servlets, etc.
The Specification Includes • WAP Architecture • Wireless Application 환경 • 프로토콜 Layers • 운영/이용 • 보안
Client WML CGI Scripts etc. WML-Script WTAI Content Etc. WAP Architecture Web Server WAP Gateway WML Encoder WSP/WTP HTTP WMLScript Compiler WML Decks with WML-Script Protocol Adapters WML 1.0버전시 인터넷접속을 하기 위한 게이트웨이가필요 cf) WML2.0 인터넷 액세스기능
Wireless Application Protocol Internet HTML JavaScript Other Services and Applications Wireless ApplicationEnvironment (WAE) Transaction Layer (WTP) Session Layer (WSP) HTTP Security Layer (WTLS) TLS - SSL Transport Layer (WDP) TCP/IP UDP/IP Bearers: IS-136 CDPD PDC-P CDMA Etc.. SMS USSD CSD Internet vs. WAP
<HTML> <HEAD> <TITLE>NNN Interactive</TITLE> <META HTTP-EQUIV="Refresh" CONTENT="1800, URL=/index.html"> </HEAD> <BODY BGCOLOR="#FFFFFF" BACKGROUND="/images/9607/bgbar5.gif" LINK="#0A3990" ALINK="#FF0000" VLINK="#FF0000" TEXT="000000" ONLOAD="if(parent.frames.length!=0)top.location='http://nnn.com';"> <A NAME="#top"></A> <TABLE WIDTH=599 BORDER="0"> <TR ALIGN=LEFT> <TD WIDTH=117 VALIGN=TOP ALIGN=LEFT> <WML> <CARD> <DO TYPE="ACCEPT"> <GO URL="/submit?Name=$N"/> </DO> Enter name: <INPUT TYPE="TEXT" KEY="N"/> </CARD> </WML> <HTML> <HEAD> <TITLE>NNN Interactive</TITLE> <META HTTP-EQUIV="Refresh" CONTENT="1800, URL=/index.html"> 010011010011110110010011011011011101010010011010 Big Pipe - Small Pipe Syndrome Internet Wireless network HTTP/HTML WAP Content encoding 위치: WAP GATEWAY WAE에서 태그별로지정된 해당 핵사값으로 인코딩한 후에 무선단말기로 전송,무선단말기로부터전송받은 헥사값을 wml로 디코딩하여 wap무선사이트로 전송
WAP Application 환경목표 • Network- neutral application environment • For narrowband wireless devices • With an Internet/WWW programming model • And a high degree of interoperability
Device-Side Problems • Device Independent • Network Independent • Different vendors – requires interfaces • Initial focus on phones • Slow reactions • Small memory • Limited CPU • Small screen • Limited input model
WML Wireless Markup Language
WML • Tag-based browsing language: • Screen management (text, images) • Data input (text, selection lists, etc.) • Hyperlinks & navigation support • Based on XML
WML (cont.) • Card metaphor • User interactions are split into cards • Navigation occurs between cards • Cards are put in to decks • Explicit inter-card navigation model • Hyperlinks • User interface Event handling • History • State management and variables • Reduce network traffic • Results in better caching
모든 deck 꼭! 아래를 포함… • Document prologue • XML & document type declaration • <WML> element • Must contain one or more cards <?xml version="1.0“?> <!DOCTYPE WML PUBLIC "-//WAPFORUM//DTD WML 1.0//EN" "http://www.wapforum.org/DTD/wml.xml"> <WML> ... </WML>
Hello World Example <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <cardid="Card1" title=“교원양성코스"> <p> <!-- Hello World example --> Hello World </p> </card> </wml>
기본 Tags • <wml> </wml>,<html> </html> 이것과 같이 ‘deck’ 시작과 긑에 정의 • <card> </card> , card시작과 긑에 정의
환경설정기본 • WML text content type: text/vnd.wap.wml • 서블릿에서 아래 함수를 통해 생성된 wml file을 전송할 수 있다. • setContentType(“text/vnd.wap.wml”) in a servlet • 톰캣 환경설정에 정확하게 타입이 설정필요
Tomcat 환경설정 • /conf/web.xml • web.xml file 에 content type 세팅
Content Type 세팅 <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN“"http://java.sun.com/j2ee/dtds/ web-app_2_2.dtd"> <web-app> <mime-mapping> <extension> wml </extension> <mime-type> text/vnd.wap.wml </mime-type> </mime-mapping> </web-app>
Text Formats <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <cardtitle=“Text Formats"> <p> normal, <strong>strong</strong>, <em>emphasized</em>, <b>bold</b>, <i>italic</i>, <u>underline</u>, <big>big</big> and <big><big>very big</big></big>, <small>small</small> <br/> </p> </card> </wml>
Tables <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <cardtitle=“Table"> <p> <tablecolumns="2"> <tr><th><b>Name</b></th> <th><b>Phone</b></th></tr> <tr><td>Bart</td><td>123</td></tr> <tr><td>Lisa</td><td>321</td></tr> </table> </p> </card> </wml>
Anchors • <anchor> tag는사용자가 링크를선택했을대 무엇을 할것인지 정의 • Comes with a task: go, pre, refresh • For example, <anchor>Login page <go href=“login.wml"/> </anchor>
A Tag • The <a> tag는 항상 “go” task를 실행한다. • For example, <a href=“login.wml">Login page</a>
Example <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <cardtitle=“Using A Tag"> <p> <ahref=“hello.wml">To Hello World</a> </p> </card> </wml>
User Input 처리 • Select lists • Choose from a list of options • Input fields • Enter a string of text or numbers • KEY variables • Set by SELECT and INPUT elements • How user input is passed to other cards and the application server
Select From Options <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title=“Tutorials"> <p> <select> <option value="htm">HTML Tutorial</option> <option value="xml">XML Tutorial</option> <option value="wap">WAP Tutorial</option> </select> </p> </card> </wml>
Select From Options <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title=“Tutorials"> <p> <select multiple="true“ default=“htm; xml”> <option value="htm">HTML Tutorial</option> <option value="xml">XML Tutorial</option> <option value="wap">WAP Tutorial</option> </select> </p> </card> </wml>
Input Fields <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="Input"> <p> Name: <input name="Name" size="15"/><br/> Age: <input name="Age" size="15" format="*N"/><br/> Sex: <input name="Sex" size="15"/></p> </card> </wml>
Other INPUT Attributes • DEFAULT=key_value • Default KEY variable (displayed to user) • FORMAT=format_specifier • If omitted, free-form entry is allowed • EMPTYOK="TRUE" • Browser will accept null input, even with format • TYPE=TEXT | PASSWORD • Special entry mode handled by the browser • MAXLENGTH=number • Maximum number of allowed characters
FORMAT Control Characters • N Numeric character • A, a Alphabetic character • X, x Numeric or alphabetic character • M, m Any character • Leading backslash specifies forced characters • Forced characters included in KEY variable value • Leading * specifies 0 or more characters • Password: FORMAT=“mmmm*m” • Leading number specifies 0..N characters • Zipcode: FORMAT=“NNNNN\-4N”
Tasks • The <go> task represents the action of switching to a new card • The <prev> task represents the action of going back to the previous card • The <refresh> task refreshes some specified card variables • If any of the variables are shown on the screen, this task also refreshes the screen • The <noop> task says that nothing should be done
do Action • The <do> tag can be used to activate a task when the user chooses a word/phrase on the screen <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card> <p> <do name="back" type="prev" label="Back"> <noop/> </do> </p> </card> </wml> Overrides the Back link to noop
DO Element • Binds a task to a user action • Action type: ACCEPT, OPTIONS, HELP PREV, DELETE, RESET • Label: Text string or image (optional) • Task: GO PREV, REFRESH, NOOP • Destination: URL • Post data: if METHOD=POST <DO TYPE="ACCEPT" LABEL="Next"> <GO URL="http://www.mysite.com/file.wml"/> </DO>
Task Binding Rules • User actions are scoped at three levels• Deck • Card • Anchored links & select list options (ACCEPT) • When tasks are bound to an action at different levels,the action with narrower scope takes precedence • Default task bindingsUser ActionTask ACCEPT, PREV PREV Others NOOP
변수 • Variables store data when a user switches from card to card in a deck • WML variables are case sensitive • Setting a value to a variable: <setvar name="i" value="500"/> Set a value to i
입력 받은 변수값 세팅 <card id=“card1"> <select name=“i"> <option value=“500">The Number 500</option> <option value=“Five Hundred">500 in Text</option> </select> </card> i에 변수값 세팅 <card id="card2"> <p>You selected: $(i)</p> </card> i값 가져오기
클릭한 부분 찾기 <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <cardid=“Card1” title=“The DBI Course”> <do type=“accept” label=“Next”> <gohref=“#Card2”/> </do> <p> Select Next to go to Card 2. </p> </card> <cardid=“Card2” title=“The DBI Course”> <p> I'm Card 2. </p> </card> </wml>
Events • 3가지 이벤트 타입: • onenterbackward– Occurs when the user navigates into a card using a “prev” task • onenterforward– Occurs when the user navigates into a card using a “go” task • ontimer– Occurs when the "timer" expires
Timer <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN“ "http://www.wapforum.org/ DTD/wml_1.1.xml"> <wml> <cardid="Intro" ontimer="#Main" title=“DBICourse"> <timervalue="150"/> <p> Welcome to the dbi site!! We will bring you to our main page after 15 seconds. </p> </card> <cardid="Main" title="Menu"> <p> This is our main page. Under construction. </p> </card> </wml>
== DBI Course == Welcome to the dbi site!! We will bring you to our main page after 15 seconds.___________________________ Back === Menu === This is our main page. Under construction.___________________________ Back
입력 <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <cardid="main" title=“DBI Example"> <dotype="accept" label="Next"> <gohref="#wel"/> </do> <p> Please enter your name: <inputtype="text" name=“iname"/> </p> </card> <cardid="wel" title="Welcome"> <dotype="prev" label="Back"> <prev/> </do> <p> Your name is $(iname). Click Back to go to previous page. </p> </card> </wml>
“Next” 선택 이름 입력 옵션선택
서버로 데이터 보내기 <?xmlversion="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <cardid="main" title=“DBI Example"> <dotype="accept" label=“Send"> <gomethod=“POST" href=“dbi/registerServlet"> <postfieldname="firstname" value="$(first)"/> <postfieldname=“course" value=“dbi"/> </go> </do> <p> Please enter your first name: <inputtype="text" name="first"/> </p> </card> </wml>