整理了一些wap入门知识点,收集了一些wap网站学习资料
(一) 添加MIME映射,注册WAP页面类型文件
如何在IIS(Microsoft Internet Information Server)上建立WAP网站
1.在IIS 平台创建一个新的MIME类型 先选择WAP站点的属性,再加入MIME类型,然后选择HTTP Headers标签。
在MIME Map部分,点击File Type并且输入以下信息:
Associated Extension
MIME Type
wml
text/vnd.wap.wml
wmlc
application/vnd.wap.wmlc
wbmp
image/vnd.wap.wbmp
wmlsc
application/vnd.wap.wmlscriptc
wmls
text/vnd.wap.wmlscript
wsc
application/vnd.wap/wmlscriptc
完成以后,将会显示以下几种类型:
(二).用IE浏览WAP页面.
如果您的IE不能正常浏览WAP,可能您的IE浏览器可能屏蔽了Activex技术。您可以设置IE浏览器属性。
打开IE-->工具菜单-->Internet选项-->弹出对话框,如下图。选择安全选项卡,点击“自定义级别”,出现“安全设置”对话框,根据图2所示,选择启用,然后确定即可。
请参考下图:
图1
图2
(三).强制输出WML格式,可供多种设备类型访问
强制输出WML:
在web.config
添加下面内容<system.web>下
1.
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<use var="HTTP_USER_AGENT"/>
preferredRenderingType = "wml11"
preferredRenderingMime = "text/vnd.wap.wml"
preferredImageMime = "image/vnd.wap.wbmp"
</browserCaps>
2.如果定义相关其它属性可以完整的移动设置属性:
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<use var="HTTP_USER_AGENT"/>
browser=Unknown
version=0.0
majorversion=0
minorversion=0
frames=false
tables=false
cookies=false
backgroundsounds=false
vbscript=false
javascript=false
javaapplets=false
activexcontrols=false
win16=false
win32=false
beta=false
ak=false
sk=false
aol=false
crawler=false
cdf=false
gold=false
authenticodeupdate=false
tagwriter=System.Web.UI.Html32TextWriter
ecmascriptversion=0.0
msdomversion=0.0
w3cdomversion=0.0
platform=Unknown
css1=false
css2=false
xml=false
mobileDeviceManufacturer = "Unknown"
mobileDeviceModel = "Unknown"
gatewayVersion = "None"
gatewayMajorVersion = "0"
gatewayMinorVersion = "0"
preferredRenderingType = "wml11"
preferredRenderingMime = "text/vnd.wap.wml"
preferredImageMime = "image/vnd.wap.wbmp"
defaultScreenCharactersWidth = "12"
defaultScreenCharactersHeight = "6"
defaultScreenPixelsWidth = "96"
defaultScreenPixelsHeight = "72"
defaultCharacterWidth = "8"
defaultCharacterHeight = "12"
screenBitDepth = "1"
isColor = "false"
inputType = "telephoneKeypad"
numberOfSoftkeys = "0"
maximumSoftkeyLabelLength = "5"
canInitiateVoiceCall = "false"
canSendMail = "true"
hasBackButton = "true"
rendersWmlDoAcceptsInline = "true"
rendersWmlSelectsAsMenuCards = "true"
rendersBreaksAfterWmlAnchor = "false"
rendersBreaksAfterWmlInput = "false"
rendersBreakBeforeWmlSelectAndInput = "true"
requiresAttributeColonSubstitution = "true"
requiresPhoneNumbersAsPlainText = "false"
requiresUrlEncodedPostfieldValues = "false"
requiredMetaTagNameValue = ""
rendersBreaksAfterHtmlLists = "true"
requiresUniqueHtmlCheckboxNames = "true"
requiresUniqueHtmlInputNames = "true"
requiresUniqueFilePathSuffix = "true"
supportsCss = "false"
hidesRightAlignedMultiselectScrollbars = "false"
canRenderAfterInputOrSelectElement = "true"
canRenderInputAndSelectElementsTogether = "true"
canRenderOneventAndPrevElementsTogether = "true"
canCombineFormsInDeck = "true"
canRenderMixedSelects = "true"
canRenderPostBackCards = "true"
canRenderSetvarZeroWithMultiSelectionList = "true"
supportsImageSubmit = "true"
supportsSelectMultiple = "true"
requiresHtmlAdaptiveErrorReporting = "false"
requiresContentTypeMetaTag = "false"
requiresDBCSCharacter = "false"
requiresOutputOptimization = "false"
supportsAccesskeyAttribute = "false"
supportsInputIStyle = "false"
supportsInputMode = "false"
supportsIModeSymbols = "false"
supportsJPhoneSymbols = "false"
supportsJPhoneMultiMediaAttributes = "false"
maximumRenderedPageSize = "2000"
requiresSpecialViewStateEncoding = "false"
requiresNoBreakInFormatting = "false"
requiresLeadingPageBreak = "false"
supportsQueryStringInFormAction = "true"
supportsCacheControlMetaTag = "true"
supportsUncheck = "true"
canRenderEmptySelects = "true"
supportsRedirectWithCookie = "true"
supportsEmptyStringInCookieValue = "true"
cachesAllResponsesWithExpires = "false"
requiresNoSoftkeyLabels = "false"
defaultSubmitButtonLimit = "1"
supportsBold = "false"
supportsItalic = "false"
supportsFontSize = "false"
supportsFontName = "false"
supportsFontColor = "true"
supportsBodyColor = "true"
supportsDivAlign = "true"
supportsDivNoWrap = "false"
supportsCharacterEntityEncoding = "true"
isMobileDevice="false"
</browserCaps>
(四).WML
1、XML程序的基本结构
一个简单的页面开始。
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.com/DTD/wml_1.1.xml">
<wml>
<card title="wap">
<p>Hello! </p>
</card>
</wml>
此程序在手机上显示Hello!
WML语言是一个很严格的,哪怕一点不同都会导致错误。所有的WML程序必须在文件的开头处声明XML文件类型,包括XML的版本,WML的文档类型、所用规范等。声明形式如下:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.com/DTD/wml_1.1.xml">
WML文档是由“卡片(Card)”和“卡片组(Deck)”构成的,一个Deck是一个或多个Card的集合。当客户端发出请求之后,WML即从网络上把Deck发送到客户浏览器,这时用户就可以浏览Deck内包含的所有Card,而不必从网上单独下载每一个Card,程序中的第一个Card是缺省得可见的Card。
<xml>标签:该标签用于包含和定义WML的一个Deck。它有一个可选的xml:lang属性来制定文档的语言,比如<wml xml:lang="zh">表示文档语言为中文。
<card>标签:WML均使用<card>和</card>进行包含和定义。 <card>同时可以包含多个可选的属性,
如:
<card id="name" title="label" newcontext="false" ordered="true" onenterforwand="url" pmemterbackward="url" ontimer="url"> </card>
(五).编程技巧
1.声明wml文件类型。这可采用ASP的Response对象,并将ContentType作为它的方法,书写时使用<%和%>包含起来,格式为:
<% Response.ContentType="text/vnd.wap.wml" %>
2.
具体属性的意思可以考试MSDN:设备功能列表
ms-help://MS.MSDNQTR.2003FEB.2052/mwsdk/html/mwlrfDeviceCapabilitiesTable.htm
2.链接:
在同一个aspx文件,使用Link控件的,#FORM来切换不同Form时在 OPenWave 5.0测试会出现错误!
建议在程序通过ActiveForm来做
3.乱码:
如果在开发过程出现乱码,通过修改Web.Config
<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
/>
4.取消移动设备缓存:
Page.Response.Expires = -1;
Response.CacheControl = "Public";
5.重定向
重定向通过
RedirectToMobilePage函数
不过使用过程中可能会出现一些问题
建议用Link控件来代替
6. 获取手机Wallpaper尺寸: Size = Request("HTTP_X_UP_DEVCAP_SCREENPIXELS")'
7. 获取手机的型号:
str=request.ServerVariables("ALL_HTTP")
t=instr(1,str,"HTTP_USER_AGENT")+16
e=instr(t,str,"/")-t
Mobile_Type=mid(str,t,e)
8.获取真实手机号码
mobile=Request.ServerVariables("HTTP_X_UP_CALLING_LINE_ID")
mobile=mid(mobile,3,11)
(六)简单例子:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="HELLO" title="HELLO">
<p>
Hello world!
</p>
</card>
</wml>
显示结果如下:
------ HELLO ------
Hello World!
WML外部引用方式跟HTML相同
http://www.itsalon.net/index.wml 或
http://www.itsalon.net/index.wml#login
内部引用,如果next是当前DECK中的一个CARD时,可以用这种方式:
#next
提供链接功能的WML元素有2个:<go>和<anchor>.
(七).WAP术语
WAP——-- 无线应用协议WAP(Wireless Application Protocol)
WML------ (无线标记语言,为Java的一个扩展的子集)
WMLScrip- (WML脚本语言,为JavaScrip语言的一个扩展的子集)
WAE——-- WAP标准所定义的无线应用环境WAE(Wireless Application Environment)
WTA——WAP标准定义的无线电话应用WTA(Wireless Telephony Applications)
GSM——全球数字移动电话系统(Global System for Mobile communications)
CDMA——码分多路访问(Code Division Multiple Access)系统
TDMA----数字蜂窝移动通信系统
CDMA----Code Division Multiple Access,中文含义是码分多址
GPRS----(通用分组无线系统)
CDPD----(蜂窝数字分组数据网)
CSD-----(电路交换式数据网)
SMS-----(短消息服务)
WTA-----(电话业务)
WTAI----(WTA的编程接口)
WTAI----(无线电话应用接口)
WSP-----无线会晤协议(WSP)提供两类服务:面向连接的服务(工作于WTP之上)和无连接的服务(工作于WDP之上)
WTLS----无线会话协议
WTP---- 无线事务处理协议
WDP-----无线数据报协议
BlueTooth——指无线数据和话音传输的开放性标准
IIS--- 网际网络信息服务器
PWS--- 个人网页服务器
(八).相关开发资料链接:
http://msdn.microsoft.com/mobility/downloads/sdks/default.aspx
http://www.dotnet247.com/247reference/__site/72
http://www.wapease.com
http://www.sp-forum.org/download/list.asp?type=14
http://www2.chn.monternet.com:8080/devdownload/DevWapSimulator.jsp
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.aspnet.mobile/
http://www.411asp.net/home/tutorial/howto/wap
http://www.chinaunix.net/jh/26/15965.html
http://www.esofun.com/ceo/article.asp?id=1
http://www.cnblogs.com/aierong/archive/2005/06/22/50279.html
http://www.xahz.com/Hzcommunication/ArticleInfo.asp?id=212
http://blog.93133.com/?action=show&id=166
http://www.mohappy.com/Soft/resources/spresource/200502/538.html
mobile:
1.http://www.microsoft.com/mobile/developer
2.http://mobility.microsoftdev.com
3.http://www.asp.net/mobile
4.http://www.microsoft.com/mobile/partner
5.http://www.microsoft.com/mobile/mobile2market
5.http://msdn.microsoft.com
特别推荐:
http://www.wapdotnet.com/HDLabTopicList.aspx?ForumID=9&Page=2
这个论坛不仅仅是一个论坛,还是一个wap开发知识宝库,有好多wap教程和wap(.net和非.net方面都有)
方面的源代码示例可以下载