# Hi, I have a WAP question

This topic is 5478 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi I wanted to know how to transfer data between two users using a WAP page... I want to make a chat for example, how do I save the messages so that other users will be able to view them too? Thanks in advance for answering

##### Share on other sites
You need a server side application for that. When a user sends a message you save it in a database, and when the recipient's request comes in you check the database to see if he has any messages, find the former message in the database and send it to him.
There's no way to do it with static WAP pages - you'll need something like PHP, or ASP, or servlets, etc.

shmoove

##### Share on other sites
I already know ASP so it wouldn't be so hard to use it. One question though, how do I combine them? I mean, if I write the ASP commands on the WAP page, the WAP will be supposed to execute them and not the server and I will probably get an error message. I need to know where to write the ASP commands and how to present that info on a WAP page later.
Thanks again for the help

##### Share on other sites
You wont be using a wap page!

You will make a http connection to the ASP page passing in variables!

Take a look at Suns site to find more.

http://java.sun.com/j2me/

##### Share on other sites
Quote:
 Original post by LinkOfTimeHi again, thanks for answeringI already know ASP so it wouldn't be so hard to use it. One question though, how do I combine them? I mean, if I write the ASP commands on the WAP page, the WAP will be supposed to execute them and not the server and I will probably get an error message. I need to know where to write the ASP commands and how to present that info on a WAP page later.Thanks again for the help

It works exactly the same way as it would on a web based chat application, except that instead of having the ASP outputing html, it outputs wml. The phone doesn't execute the commands, the server does.

For example:
Dim msg' ...msg = GetMessageFromDatabase(user_id)If IsNull(msg) or IsEmpty(msg) Then  %>  You have no messages.  <%Else  %>  You have a message:  <%  Response.Write(msg)End If

Only the bold parts are sent to the phone, all the code runs on the server.

shmoove

##### Share on other sites
Nevermind what was written here, I didn't see the latest reply when I wrote it. Anyway, I didn't exactly understand the latest reply. How do I send the bold parts to the phone? Do I just write the entire code on the wml page? Or is that an ASP page which somehow sends the bold parts to the phone...?
Thanks again for the replies :)

##### Share on other sites
Like I said, it's exactly the same as in regular web development. You say you know ASP, right? Well then you know that ASP is a language that runs on the server, querying databases, performing logic, etc. to dynamically create html pages. Well it can be used in exactly the same way for the wireless web. The only difference is that instead of sending html tags, you send wml tags.

Quote:
 How do I send the bold parts to the phone? Do I just write the entire code on the wml page? Or is that an ASP page which somehow sends the bold parts to the phone...?

Well, technically, you don't "send" the data to the phone. The phone requests the data by browsing to your page and you respond to that request.

Say this is an ASP page (mypage.asp):
<% Response.ContentType = "text/vnd.wap.wml" %> <?xml version="1.0" encoding="iso-8859-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml>	<head>		<meta http-equiv="Cache-Control" content="max-age=0" forua="true"/> 			</head><card><p align="center">	My Page	<br/>		<% 	If Request.Querystring("msg") == "hi" Then		%>You said hi<%	Else		Dim name		name = Request.QueryString("name")		%>Hello <%=name%>, what do you say today?<%	End If        %>	</card></wml>

If a user uses hits the page mypage.asp?msg=hi he will receive this response:
<?xml version="1.0" encoding="iso-8859-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml>	<head>		<meta http-equiv="Cache-Control" content="max-age=0" forua="true"/> 			</head><card><p align="center">	My Page	<br/>You said hi	</card></wml>

but if he hits the page mypage.asp?name=shmoove, then the response will look like this:
<?xml version="1.0" encoding="iso-8859-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml>	<head>		<meta http-equiv="Cache-Control" content="max-age=0" forua="true"/> 			</head><card><p align="center">	My Page	<br/>Hello shmoove, what do you say today?	</card></wml>

The phone never sees the ASP code, it only receives straight wml, which it knows how to display.

Now if instead of just checking the querystring, your logic (the ASP code) involved looking up in the data base to see if there are any messages, and displaying them in a similar fashion, you would have a chat application.

Hope that makes it clearer.

shmoove

##### Share on other sites
Hi again
Thanks a lot for all the help. I finally understood it. I am going to try it later and post a message whether it worked or not.
Thanks again

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 11
• 10
• 9
• 15
• 22