Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 10th, 2003, 08:58 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Article Discussion: PHP Interacting with J2ME

If you have any questions or comments about this article then please post them here!

Reply With Quote
  #2  
Old June 14th, 2003, 04:03 AM
DDDooGGG DDDooGGG is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Melbourne, Australia
Posts: 97 DDDooGGG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 33 sec
Reputation Power: 6
Hi, i read this article and have found it very interesting, but i am having a problem with the writing the code for the phone. Which file do i use to store the code?
__________________
regards,


Fulton

Last edited by DDDooGGG : June 16th, 2003 at 12:55 AM.

Reply With Quote
  #3  
Old June 17th, 2003, 09:33 AM
jasonlam604 jasonlam604 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 jasonlam604 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
More Detail Please

Hi DDDooGGG

Please give me more detail? What do you mean which file?
If like I can send you the source. Email me your email at

jasonlam_ at hotmail dot com

Regards, Jason

Reply With Quote
  #4  
Old June 17th, 2003, 11:09 PM
DDDooGGG DDDooGGG is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Melbourne, Australia
Posts: 97 DDDooGGG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 33 sec
Reputation Power: 6
i downloaded the J2ME development kit and instaled no problem. Am i able to use IIS 5.1 instead of Apache?
Where does the following J2ME Source Code go:
PHP Code:
 import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class 
SimpleFetch extends MIDlet {

    private 
Display display;
    
    
String url "http://127.0.0.1/midlet/helloworld.txt";

    public 
SimpleFetch() {
       
display Display.getDisplay(this);
    }
    
    public 
void startApp() {
 try {
            
getViaStreamConnection(url);
 } catch (
IOException e) {
            
//Handle Exceptions any other way you like.
            
System.out.println("IOException " e);
            
e.printStackTrace();
 }
    }
    public 
void pauseApp() {   }
    public 
void destroyApp(boolean unconditional) {  }

    
/**
     * Read URL as Stream
     */
    
void getViaStreamConnection(String urlthrows IOException {
        
StreamConnection streamConnection null;
        
InputStream inputStream null;
        
StringBuffer b = new StringBuffer();
        
TextBox textBox null;
        try {
          
streamConnection = (StreamConnection)Connector.open(url);
          
inputStream streamConnection.openInputStream();
          
int ch;
          while((
ch inputStream.read()) != -1) {
             
b.append((charch);
          }          
          
textBox = new TextBox("Simple URL Fetch"b.toString(), 10240);
        } 
finally {
           if(
inputStream != null) {
              
inputStream.close();
           }
           if(
streamConnection != null) {
              
streamConnection.close();
           }
        }        
        
display.setCurrent(textBox);
    }



How do i call this file in the mobile?

Reply With Quote
  #5  
Old June 18th, 2003, 02:11 AM
jasonlam604 jasonlam604 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 jasonlam604 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Learn J2ME

I assume you know Java, just follow the user guide

If you installed it on your c: drive you will find it under

c:\WTK20\docs\UserGuide.doc

The guide goes through a simple build and compile. Once
you've done that then use the code in the article.

Regards, Jason

Reply With Quote
  #6  
Old June 20th, 2003, 04:03 AM
AmericanD AmericanD is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 81 AmericanD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Hey Jason,

Nice article! oh man i just thought JSP could link with J2ME and was dying for a better solution. PHP saved the day

ok i got 3650 just for J2ME programming. I've done alot on the emulator so far.

and i also got the USB bluetooth belkin adapter and tested it with my laptop and detecting the phone. works fine

but now how do i move my application .jar or .jad file to the phone? any idea? and which directory does WTK store the .jar and .jad file?

lookin forward to hear from you. I even emailed you once a few weeks back ..

take care
saeed
__________________
Hungry for Code

Programming works best with a team over one single person

Reply With Quote
  #7  
Old June 20th, 2003, 09:40 AM
jasonlam604 jasonlam604 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 jasonlam604 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi AmericanD

Sorry I must have deleted your email by mistake!

If you installed it on your c: drive you will find it under

c:\WTK20\apps\[name_of_project]\bin\[name_of_project].jar
c:\WTK20\apps\[name_of_project]\bin\[name_of_project].jad

Do you have the 'Nokia PC Suite' software from Nokia, this will
allow you to upload via infrared, bluetooth or USB. Try this
url URL
If it doesn't work just go to URL select 'Phones'
form main menu and select your phone from drop down ---->
3650 <---- and then near the bottom there should be a link
about software download... then just follow a few more links
and the download should start. Yes it is FREE.

fyi, any language/script can link to J2ME as long as
you use the same protocol, SOAP, sockets, HTTP,... etc

Anymore questions or problems email me, if you don't hear
from me within a few days try again

I hope I've been helpful!

Regards, Jason

Reply With Quote
  #8  
Old August 8th, 2003, 08:06 AM
hmiz hmiz is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: London
Posts: 2 hmiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to hmiz
Hi, I found this article very very helpful but if could someone help me with this problem.. I have a php page and I want a MIDlet to interact with it. I want the user to enter their username and password and then the information should go to the page using POST. Could someone please help me?

Reply With Quote
  #9  
Old November 21st, 2003, 06:50 AM
conoroleary conoroleary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 6 conoroleary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 9 sec
Reputation Power: 0
This is an well written article, I have a problem though when I try to run the 'simple web services' example:

org.kxml.io.ParseException: unexpected: StartTag <br> line: -1 attr: null @-1:-1

Does anybody know why this is happening? Thanks in advance.

Reply With Quote
  #10  
Old December 2nd, 2003, 01:11 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
conoroleary,

Can you post the code you're using? Did you copy directly from the article, or did you retype it yourself?

Reply With Quote
  #11  
Old December 3rd, 2003, 07:00 AM
conoroleary conoroleary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 6 conoroleary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 9 sec
Reputation Power: 0
Thank you for your interest FrankieShakes.

I've recognised the problem now: on the server I used the wrong 'include' path to my SOAP classes.

This raises a new question for me: how do I debug SOAP servers(I had no idea from the client output what the problem was)?

Reply With Quote
  #12  
Old December 11th, 2003, 06:21 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
conoroleary,

That's a good question... What SOAP package were you using on the server side? Were you using any client-side (J2ME-enabled) SOAP clients?

Reply With Quote
  #13  
Old December 12th, 2003, 04:19 AM
conoroleary conoroleary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 6 conoroleary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 9 sec
Reputation Power: 0
I was using NUSOAP on the server side,
Ksoap on the J2ME client.

It's the servers responcibility in this instance to throw an appropriate error message, maybe $php_errormsg could be returned to the client?

http://www.php.net/manual/en/reserv...s.phperror msg

Reply With Quote
  #14  
Old December 15th, 2003, 02:56 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
I haven't yet played with NuSOAP... That's actually something I plan on doing early this week. Was hoping to get to it today, but things have been pretty busy for me.

As for the $php_errormsg, that seems like a good way of doing it. You could definitely build that functionality into your service.

I'm working on a J2ME app that will return currency exchange information using XML-RPC... I may also look into using SOAP, as there are many SOAP services that offer currency information. I wasn't able to find any XML-RPC services, so I was developing my own.

OT: Were you able to get the kSOAP examples working at all? I keep getting an exception whenever I try to run the examples through the WTK emulator.

Reply With Quote
  #15  
Old December 16th, 2003, 04:43 AM
conoroleary conoroleary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 6 conoroleary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 9 sec
Reputation Power: 0
What type of exception errors were you getting?

I've left this project for the moment, so I haven't tried to get KSoap to work yet.

How will you keep the currency rates updated?

I will be developing a similar project later in the year, and I imagine I will probably be using http://www.xe.com/ucc/ (or similar) to get the currency converision rates for 'my' web service.

Reply With Quote
  #16