A listening J2ME client ???

How can I implement, that a Java client listens for incoming messages (HTTP, UDP, WAP) and reacts to them? I want to build a database which can be accessed from many users using their Javaphones in some way. If some user changes data, all other connected Java clients should be informed and updated.
Does that work with WAP PUSH? I realised that the MIDP/CLDC provide UDP, that offers the DatagramConnection interface which can be used in server and in client mode.
Has anybody some good ideas?

Hi,
You'd better read " Advanced MIDP Networking, Accessing Using Sockets and RMI from MIDP-enabled Devices " article on http://wireless.java.sun.com/midp/articles/socketRMI/.
This article:
Gives you a brief overview of CLDC and MIDP Networking
Discusses a middleman architecture for using sockets, RMI, and other Internet services
Shows you how to use sockets from MIDP-enabled devices
Shows you how to send emails from your MIDP-enabled device
Shows you how to use RMI from MIDP
Take care,
Faruk

Similar Messages

  • Bluetooth simulation between J2SE server and J2ME client

    hi there,
    I have a working bluetooth client/server application (using BlueCove), with the server on a PC (the PC has bluetooth hardware) and the client on a mobile telephone.
    I wish to move the application to a bluetooth simulated environment, however.
    To simulate bluetooth between 2 mobiles, I could open 2 instances of the WTK simulator and the mobiles will find each other -- but this doesn't meet my needs. I wish to simulate the bluetooth environment between a J2SE server and a J2ME client.
    Can I do this using the wireless toolkit? Does anyone have other ideas?
    thanks,
    Manoj

    OK - I have the solution.
    My PC (server) code used BlueCove to talk to the bluetooth stack. The trick is to use Sun's own KVM packages. This creates a virtual bluetooth device on your machine, shared by the WTK emulator.
    Here's the server code:
    package com.encube;
    import java.awt.BorderLayout;
    import java.io.InputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.io.StreamConnectionNotifier;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import com.sun.kvem.bluetooth.BluetoothStateException;
    import com.sun.kvem.bluetooth.DiscoveryAgent;
    import com.sun.kvem.bluetooth.LocalDevice;
    public class Server {
         public static final String UUID_STRING = "A781FDBA229B486A8C21CEBD00000000";
         public static final String SERVICE_NAME = "BTCHATSVR";
         private StreamConnectionNotifier server;
         JFrame jframe;
         JTextArea textArea;
         public static void main(String[] args) {
              Server svr = new Server();
              svr.doWork();
         public void doWork() {
              this.jframe = new JFrame("BT Server");
              this.jframe.setLayout(new BorderLayout());
              this.textArea = new JTextArea(6, 20);
              JScrollPane jsp = new JScrollPane(this.textArea);
              this.jframe.add(jsp, BorderLayout.CENTER);
              this.jframe.pack();
              this.jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              this.jframe.setVisible(true);
              startServer();
         public void logMessage(String message) {
              this.textArea.setText(this.textArea.getText() + message + "\n");
              this.textArea.setCaretPosition(this.textArea.getText().length());
         public void startServer() {
              LocalDevice local;
              try {
                   local = LocalDevice.getLocalDevice();
                   local.setDiscoverable(DiscoveryAgent.GIAC);
                   this.logMessage("max of "
                             + LocalDevice
                                       .getProperty("bluetooth.connected.devices.max")
                             + " connection(s) supported");
                   String url = "btspp://localhost:" + UUID_STRING + ";name="
                             + SERVICE_NAME;
                   server = (StreamConnectionNotifier) Connector.open(url);
                   this.logMessage("waiting for connection...");
                   StreamConnection conn = server.acceptAndOpen();
                   this.logMessage("connection opened");
                   InputStream is = conn.openInputStream();
                   byte buffer[] = new byte[1000];
                   while (true) {
                        int numChars = is.read(buffer);
                        String s = new String(buffer);
                        logMessage("received from mobile phone: " + s.substring(0, numChars));
              } catch (Exception e) {
                   this.logMessage(e.getMessage());
    }You need to include the location of WTK as the kvem.home define. If its installed in c:\wtk22 (the default), start the server with the parameter -Dkvem.home="c:\wtk22". You also need to include these 3 libraries:
    c:\wtk22\wtklib\gcf-op.jar
    c:\wtk22\wtklib\kenv.zip
    c:\wtk22\wtklib\kvem.jar
    That's it for the server. My code of the sample client (the mobile phone, running in the WTK emulator) is messy (sorry about that -- still cleaning it up)!
    import java.io.IOException;
    import java.io.OutputStream;
    import java.util.Enumeration;
    import java.util.Timer;
    import java.util.TimerTask;
    import java.util.Vector;
    import javax.bluetooth.BluetoothStateException;
    import javax.bluetooth.DeviceClass;
    import javax.bluetooth.DiscoveryAgent;
    import javax.bluetooth.DiscoveryListener;
    import javax.bluetooth.LocalDevice;
    import javax.bluetooth.RemoteDevice;
    import javax.bluetooth.ServiceRecord;
    import javax.bluetooth.UUID;
    import javax.microedition.io.Connector;
    import javax.microedition.io.StreamConnection;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.StringItem;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    public class MainMIDlet extends MIDlet {
         protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
              // TODO Auto-generated method stub
         protected void pauseApp() {
              // TODO Auto-generated method stub
         protected void startApp() throws MIDletStateChangeException {
              MainForm mainForm = new MainForm();
              Display.getDisplay(this).setCurrent(mainForm);
              mainForm.initializeDisplay();
    class MainForm extends Form {
         public static final String UUID_STRING = "A781FDBA229B486A8C21CEBD00000000";
         private StringItem log;
         private DiscoveryAgent agent;
         Object lock = new Object();
         static EndPoint currentEndPoint;
         static Vector serviceRecords = new Vector();
         public MainForm() {
              super("BT Client");
         public void initializeDisplay() {
              this.log = new StringItem("", "");
              this.append(this.log);
              try {
                   LocalDevice local = LocalDevice.getLocalDevice();
                   agent = local.getDiscoveryAgent();
                   agent.startInquiry(DiscoveryAgent.GIAC, new Listener(this, agent));
              } catch (BluetoothStateException e) {
                   this.logMessage(e.getMessage());
         public void logMessage(String message) {
              this.log.setText(this.log.getText() + message + "\n");
         public void processServiceRecord(ServiceRecord sr) {
              try {
                   String url = sr.getConnectionURL(
                             ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
                   logMessage("opening URL " + url);
                   StreamConnection conn = (StreamConnection) Connector.open(url);
                   OutputStream os = conn.openOutputStream();
                   String smessage = "test message from phone emulator";
                   os.write(smessage.getBytes());
              } catch (IOException e) {
                   logMessage("error while processing service record: "
                             + e.getMessage());
         class Listener implements DiscoveryListener {
              private MainForm mainForm;
              private Vector pendingEndPoints;
              private DiscoveryAgent agent;
              public Listener(MainForm mainForm, DiscoveryAgent agent) {
                   this.mainForm = mainForm;
                   this.agent = agent;
                   this.pendingEndPoints = new Vector();
              public void deviceDiscovered(RemoteDevice dev, DeviceClass deviceClass) {
                   this.mainForm.logMessage("found device");
                   this.pendingEndPoints.addElement(new EndPoint(dev));
              public void inquiryCompleted(int arg0) {
                   this.mainForm.logMessage("done searching for devices");
                   for (Enumeration enm = this.pendingEndPoints.elements(); enm
                             .hasMoreElements();) {
                        EndPoint ep = (EndPoint) enm.nextElement();
                        ep.calculateRemoteName();
                        this.mainForm.logMessage("device name: " + ep.getRemoteName());
                   new Timer().schedule(new DoServiceDiscovery(), 100);
              public void servicesDiscovered(int transID, ServiceRecord[] arg1) {
                   mainForm.logMessage("found " + arg1.length
                             + " service(s) on device "
                             + currentEndPoint.getRemoteName());
                   for (int i = 0; i < arg1.length; i++) {
                        serviceRecords.addElement(arg1);
              public void serviceSearchCompleted(int arg0, int arg1) {
                   synchronized (lock) {
                        * unlock to proceed to service search on next device see
                        * DoServiceDiscovery.run()
                        lock.notifyAll();
                   mainForm.logMessage("done searching for services on "
                             + currentEndPoint.getRemoteName());
              * Inner class. Called a short time after the last device is found.
              class DoServiceDiscovery extends TimerTask {
                   public void run() {
                        try {
                             UUID uuids[] = new UUID[2];
                             * ok, we are interesting in btspp services only and only
                             * known ones -- check for our UUID
                             uuids[0] = new UUID(0x1101);
                             uuids[1] = new UUID(MainForm.UUID_STRING, false);
                             for (Enumeration enm = pendingEndPoints.elements(); enm
                                       .hasMoreElements();) {
                                  EndPoint ep = (EndPoint) enm.nextElement();
                                  mainForm.logMessage("searching for services on "
                                            + ep.getRemoteName());
                                  currentEndPoint = ep;
                                  ep.transId = agent.searchServices(null, uuids,
                                            ep.remoteDev, new Listener(mainForm, agent));
                                  synchronized (lock) {
                                       try {
                                            lock.wait();
                                       } catch (InterruptedException e) {
                                            // do nothing
                                            mainForm.logMessage("exception while waiting: "
                                                      + e.getMessage());
                             mainForm.logMessage("discovered all services; found "
                                       + serviceRecords.size() + " record(s)");
                             * assume we have just 1 service record
                             if (serviceRecords.size() > 0) {
                                  processServiceRecord((ServiceRecord) serviceRecords
                                            .elementAt(0));
                        } catch (Exception e) {
                             mainForm.logMessage("error during service discovery: "
                                       + e.getMessage());
    class MiscUtils {
         * Get the friendly name for a remote device. On the Nokia 6600, we're able
         * to get the friendlyname while doing device discovery, but on the Nokia
         * 6230i, an exception is thrown. On the 6230i, we get the friendly name
         * only after all devices have been discovered -- when the callback
         * inquiryCompleted is called.
         * @param dev
         * the device to examine
         * @return a friendly name for the device, otherwise the IP address as a
         * hex-string
         public static String getDeviceName(RemoteDevice dev) {
              String devName;
              try {
                   devName = dev.getFriendlyName(false);
              } catch (IOException e) {
                   devName = dev.getBluetoothAddress();
              return devName;
         public static EndPoint findEndPointByTransId(Vector endpoints, int id) {
              for (int i = 0; i < endpoints.size(); i++) {
                   EndPoint endpt = (EndPoint) endpoints.elementAt(i);
                   if (endpt.getTransId() == id) {
                        return endpt;
              return null; // not found, return null
    class EndPoint {
         // remote device object
         RemoteDevice remoteDev;
         // remote device class
         DeviceClass remoteClass;
         // remote service URL
         String remoteUrl;
         // service hosted on this device -- populated after searching for devices
         ServiceRecord serviceRecord;
         // bluetooth discovery transId, obtainsed from searchServices
         int transId = -1; // -1 must be used for default. cannot use 0
         // local user nick name
         String localName;
         // remote user nick name
         String remoteName;
         // vector of ChatPacket pending to be sent to remote service.
         // when message is sent, it is removed from the vector.
         Vector msgs = new Vector();
         public EndPoint(RemoteDevice rdev) {
              remoteDev = rdev;
         * This functionality isn't called in the constructor because we cannot
         * retrieve the friendly name while searching for devices on all phones. On
         * some phones we have to wait until after devices have been discovered.
         public void calculateRemoteName() {
              this.remoteName = MiscUtils.getDeviceName(this.remoteDev);
         public RemoteDevice getRemoteDev() {
              return remoteDev;
         public String getRemoteName() {
              return remoteName;
         public ServiceRecord getServiceRecord() {
              return serviceRecord;
         public void setServiceRecord(ServiceRecord serviceRecord) {
              this.serviceRecord = serviceRecord;
         public int getTransId() {
              return transId;
    ...and that's it. Start the server, then the client (all on the same machine) and you've simulated bluetooth between the 2.
    To get the server working with a real mobile, you'll need to use the BlueCove library instead of the 3 WTK jars (and can remove the kvem.home directive as well). The rest of the code should remain the same (haven't quite tested that yet!).
    cheers
    Manoj
    null

  • WebDAV J2ME client

    hi
    subject really says it all - i'm looking for a WebDAV J2ME client and would appreciate any help/guidance this forum can provide.
    without getting into the specifics of why i need one - assuming one is not available, is it possible to implement one ?
    thanks
    dave

    Sure it's possible!
    Read there RFC's and get going:
    - http://www.ietf.org/rfc/rfc2518.txt
    - http://www.ietf.org/rfc/rfc3253.txt
    - http://www.ietf.org/rfc/rfc3648.txt
    - http://www.ietf.org/rfc/rfc3744.txt

  • Bluetooth communication  between J2SE server and J2ME client

    Hi everyone!
    I'm new here in this forum...
    I try to make a small project to my studies,
    My project will include J2SE server and J2ME client.
    I'm stuck in the step of finding the server with the wireless toolkit emulator.
    I found this issue in old subject: here
    I try the solution in reply 6 but I don't understand exactly who to define kvem.home, and I got this error:
    " You must define the system property "kvem.home" "
    maybe someone can help me and explain how to do that?
    thanks!

    Hello,
    I want to find out how this can be done, too. I tried with
    System.setProperty("kvem.home", "C:\\WTK2.5.2");but I get an error:
    java.lang.UnsatisfiedLinkError: com.sun.kvem.jsr082.impl.bluetooth.BluetoothController.setSystemProperty(Ljava/lang/String;Ljava/lang/String;)I included these files in the build path:
    c:\WTK2.5.2\wtklib\gcf-op.jar
    c:\WTK2.5.2\wtklib\kenv.zip
    c:\WTK2.5.2\wtklib\kvem.jar
    and I import com.sun.kvem.bluetooth.*;
    I'd appreciate any help.

  • Getting User-Agent through J2ME Client

    Hi, i think most of the developers here might have come across this problem.
    I have a servlet that will get the client's User-Agent headers value when the client access it. When i access the servlet through a phone browser, the header will give me the phone's user agent. But when i access the same servlet through my J2ME client, the header will return a value of 'UNTRUSTED/1.0' string which doesn't contain any user agent info.
    I understand that in JSR implementation the 'UNTRUSTED' string will be appended to the User Agent header, but the original user agent value is not there. Does anyone knows what is the reason behind this?
    Thanx.
    FooShyn

    first:
    - do not multipost the same message
    second:
    - did you put headers on your connection in your application?
    - and the only useragent that you can get is the useragent defined in the app...
    for example:
    try {
          c = (HttpConnection)Connector.open(url);
          c.setRequestMethod(HttpConnection.GET);
          c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT");
          c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Confirguration/CLDC-1.0");
          c.setRequestProperty("Content-Language",      "en-CA");
          os = c.openOutputStream();
    ...taken from http://developers.sun.com/techtopics/mobility/midp/articles/network/ThirdExample.java

  • Chat between j2me clients and using a Servlet server

    Java gurus, please help me..
    I'm wondering if I could set up a sort of chat functionality between two j2me clients. I wish to use Java servlets as my server and Tomcat to deploy it. Is this possible? Can i do these by using http connection only or do i have to use sockets? If i use sockets, how will i configure Tomcat, or do i still need Tomcat?
    Hope someone could help! Thanks in advance! =)

    Basically it means you should have a Thread that loops and make an http request every x seconds. Before sending the request it should check if the user has typed anything, and send that with the request. The server should keep track of all the chat messages sent, and forward to all the other clients when they request an update. To keep track of what clients have received what messages, you could have a time stamp for each message, and a "last update" field for each client.
    The client should run something like this in a thread:
    while (iAmRunning) {
      url = "......." // address of your server
      if (the user typed anything since the last time we sent a request) {
        url = url + "?msg=" + whatTheUserTyped; // maybe another parameter for private messages?
        reset what the user typed (so it won't be sent next time);
      send the request;
      get the response containing what the rest of the users have
        typed since my last update;
      update the display with the latest messages;
    }And the server would handle a request like:
    if (the request contains a message) {
      save the message with the current time;
    check when was the previous update for this user;
    get all messages where the timestamp is later than the last update;
    set the last update field for the user with to the current time;
    respond with all the messages;

  • Information transfer from J2ME client to WLS 8.1 sp3 thru' SSL

    Hi,
    We are planning to have a J2ME client (CLDC 1.0 and MIDP 2.0) to transfer information to Weblogic server 8.1 sp3 through SSL. We are planning to use Verisign certificate at the Weblogic server to implement the SSL communication. Could you please let me know if there is any issue?
    I came across from BEA web-site
    (http://e-docs.bea.com/wls/docs81/notes/issues.html#1278025)recently that J2ME clients have certain issues to talk to WLS. That page says:
    Web Services Known Issues
    Change Request Number CR107595
    Description
    SSL does not work for J2ME clients on WebLogic Server 8.1.
    Certicom SSL libraries require additional features that are not supported by J2ME. Therefore, SSL is not supported for J2ME clients on WebLogic Server 8.1.
    That is why I am little apprehensive. Please advise.
    Thanks,
    Goutam.

    1) sorry, there is no official solution of "1999 schema" problem that I know of.
    2) if the service is not changed, there is no need to re-create call or stub object for every invocation.

  • Configure listener in client machine

    hello guys, please any help on how to configure listener on client machine??
    any link i can read or tutorial i'll be thankfull

    Hi,
    This question may be more appropriate for the Installation forum. However, the short answer is that you do not need a listener on any client machine, only on a server machine. Good luck!

  • J2ME client server

    Hi i have a client J2ME application written verifyed and running. I am a little new to the whole programming thing but I was wondering if anybody knew if it was possible to use JSP or a servlet to distribute an application like a quiz on my server, package this into a midlet and then send it to a client and then return the results in either sms or an e-mail format using a pop3 connection
    I think it is possible to do this in WML format. I know this would be more practical as the results would just be looked up in the browser of the deivce and these would link to the database. However I am having trouble setting up the server. I am not quite sure how to go about it.
    I have downloaded tomcat 4.1 and i have just run it on the default localhost port number. But I am not sure where to go from here. I tried to write a servlet to deal witht the application request but I am not sure how to setup a database or the files I want downloaded for OTA provisioning. I have the WTK2.0 beta with OTA. I tried uploading the final jar and jad files to my public web space but I guess since there are not supportive mime settings this will not work.
    Any advice or help would be greatly appreciated for a dummy programmer.
    thanks,
    Prashant

    I have managed to configure tomcat properly so far and am interested in a server that can discover the IP addresss of a device using a midlet.

  • Listen for client ip connections on client

    Is it possible to listen if any connections are made to a Server from the client.
    (Eg. If a client connects to a mail server from outlook, is it possible to write an app that runs on the client to determine that the connection was requested?).
    What I want to do is display the companies e-mail policy and have the user accept this before the mail is retrieved. This must work from any e-mail client. (Groupwise, Outlook etc.).
    Is there any other way of doing this?

    If you delve into the OS, you can monitor all tcp/ip-connections for connections to the mail server. I'm not absolutely sure, but I very much doubt that a program doing that can be done in Pure Java - you need native code to get that level of OS control.
    Alternatively, you can write a program that works as a simple proxy, and configure all mail clients to retrieve mail trough that proxy. It's not foolproof, though. (That is, by the way, how many virus scanners for incoming mail works.)
    (But I don't understand what you want to do this for. I would guess that it's both easier and juridically safer to do that kind of paperwork when handing out the e-mail account.)

  • Listener on Client Install

    Hi,
    My IT department recently installed Oracle10G client utilities on my work laptop and I can't access any of the systems on our network. After further investigation I noted that I don't have any Oracle services installed on the system and when I attempt to connect using Oracle Enterprise Manager I receive the error ORA-12541, No Listener.
    I then tried to check the status of the listener using lsnrctl and received another error indicating that the utility wasn't installed either.
    When I informed a member of the staff and made mention that the listener service wasn't installed nor the utility present, I was told that it was required for access from a client. Needless to say I was shocked at the remark, but nonetheless I don't claim to know everything about Oracle but I thought the listener service was most definitely a requirement to connect to the Oracle systems whether via client or on the actual server.
    Could someone please validate my assumptions as being true or no so I can go back to the staff well-informed when I push my point across, unless anyone here can say that I am wrong on this?
    Thanks in advance.

    But you still need the Listener configured and started on the Server to use your Enterprise Manager to connect to the server over the network since you are using Enterprise Manager Java Console from the client.
    1. Configure (if it is not yet done) the Listener on the Database Server
    2. Configure TNS to use on your laptop
    3. Use the TNS configuration from EM to connect to the Server
    If you are using teh Enterprise Manager Database Control (http), then you do not need the client configuration. All you need to access the database is the URL.

  • Server does not listen multiple clients

    Hi all,
    I use a thread class to listen client request, however the server can only handle the first request and do not response any more. Here is my Server code:
    import java.net.*;
    public class MyServer {
    ServerSocket s;
    MainThread mt=new MainThread();
    final int PORT=3333;
    public void MyServer(){
         try{
         s=new ServerSocket(PORT);
         System.out.println("Server started..");
         while(true){
              try{
              mt.MainThread(s.accept());
              }catch(Exception ex){
              ex.printStackTrace();}     
         }//while
         }catch(Exception ex){ex.printStackTrace();}
         finally{
              try{
              s.close();
              }catch(Exception ex){}
         }//finally
    public static void main(String [] arg){
         MyServer vs=new MyServer();
         vs.MyServer();
    And here is the thread I use for listening:
    import java.net.*;
    import java.io.*;
    public class MainThread extends Thread{
    BufferedReader in;
    PrintWriter out;
    Socket socket;
    int i=0;
    String name;
    String code;
    int index;
    /* CountryEnterence is an other class extending Thread
    and performs database operations
    CountryEnterence counEnt=new CountryEnterence();
    public void MainThread(Socket socket){
    this.socket=socket;
    start();
    public void run(){
    try{
    in=new BufferedReader(new InputStreamReader(socket.getInputStream()));
    out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);
    index=Integer.parseInt(in.readLine());
    switch(index){
    case(1001):
    System.out.println(index);
    name=in.readLine();
    code=in.readLine();
    counEnt.CountryEnterence(name,code);     
    break;
    case(1002):
    System.out.println(index);
    break;
    default:System.out.println("Unexpected index");
    }//switch
    }catch(Exception ex){ex.printStackTrace();}
    finally{
    try{
    socket.close();
    in.close();
    out.close();
    }catch(Exception ex){ex.printStackTrace();}
    }//finally
    }//run
    }//class
    I have to shutdown and restart the server each time I try the the client insert to database.
    Any help will be appriciated, thanks in advance.
    Regards,
    dirgen

    Hi dirgen,
    I suggest you get yourself a book (there are plenty of them even in german) for Java- newbies, you would get the basics better than trying to find out everything by yourself.
    Debugger: A debugger is a tool that lets you run your program step by step (line of code after line of code) or set breakpoints at specified locations in your code, check current variable values etc.
    As the name implies, it let's you check the current state of your running program and therefore find bugs by comparing expected - actual state.
    A command-line debugger is bundled with the JDK's, but it's quite uncomfortable to use. Better use debuggers provided with common IDE's such as JBuilder, Forte for Java etc. (Both mentioned are available for free in a community version - which should fit your needs. Check out http://www.borland.com for JBuilder and http://www.sun.com/forte/ffj/ for Forte).
    You will spend some extra time learning how to use those tools, but that's the way how developers write software these days. If you encounter problems using one of those tools, check out their respective forums.

  • Connection speed on j2me client

    Hi,
    Can anybody tell me how can I calculate connection speed (or bandwidth) on mobile device using j2me (midlet)?
    I know that I can measure ping to the server, but this is only one thing. I also need to know how strong is the signal in my current position in the gsm cell. Is it possible get this information using j2me?
    Thanks in advance.

    Generally: no. Only devices with the ATCommand api have access to these properties, and there are not a lot of devices that support this.

  • How to make a WORKING J2ME Web Services client?

    Hi everyone,
    I'm trying to make my first J2ME client for web services (well, I need it for my degree thesis, so I'm a little bit DESPERATE) but I've got a lot of problem that I don't understand, even with samples downloaded from web tutorials and from xmethods.net.
    The problem is with the generation of Stub classes:
    if I try to make the Java Wireless TollKit 2.2 to generate them and then I run the midlet in the JWTK emulator there's no problem, but when I try to do the same thing with the Nokia Developer's Suite 3.0 I've got a lot of problems, first of all the java code generated for the stub is very different from the first one, it seem like a C# or J# code (and obviously Eclipse says that it's full of errors), so when I try to make the jar and jad files it doesn't work (because is not a right java code), so I made the stub classes using the JWTK2.2 Stub Generator and then I used the Nokia Dev's Suite 3.0 to build and package the midlet, but it says that it's not able to find the "class or resource javax/xml/rpc/Stub" even if the resource is present and used exactly as all the other packages, and it creates a jar file with just some of the classes but not all. At the end I tryed to run in the nokia emulators the midlet created by the JWTK 2.2, but it doesn't start, so I put the midlet on two diffent Nokia phones (6600 and 6630, because I need to make my client work on the 6630) but it seems to make the virtual machine to crash. I erased all the code lines invoking the stub classes and added them again one by one, until the midlet stoped again to work, and I understand that the problem seems to be with the invocation of the costructor of the stub class, but it doesen't make no sense, because the same code works properly on not-Nokia phones and emulators. I used many different wsdl files to create the stub classes for different web services, but there's always the same problems.
    Help me please.

    You will find some working code at :
    http://ksoap.objectweb.org/software/downloads/index.html
    It's code that use kSOAP and kXML implementations ....
    If you will also find some useful information here :
    http://developers.sun.com/techtopics/mobility/apis/articles/wsa/
    http://www-106.ibm.com/developerworks/wireless/library/wi-jsr/
    http://www-106.ibm.com/developerworks/wireless/library/wi-xmlparse/
    Regards.

  • Web service client in J2ME

    Hello there, I'm a student and new to web services.
    Somehow I manged to setup a plain old java web service using Axis2, and I have tested it with an J2SE RPCclient.
    However, what I need to do is to have a J2ME client, and from some searching I have found out about KSOAP. Is there other alternatives, or can I just use AXIS2 RPCclient in J2ME?
    I know that I don't need to use java to invoke a java web service, but it's the only think I know that is widely support on phones.
    Any advice is appreciated, thanks alot!

    Thanks for that link on JSR-172!
    One question though.. is it advisable to create a RPC client without using stubs? I don't quite like the idea of stubs and the code it contains.
    I did my axis2 J2SE client without stubs, but I can't seem to find any tutorial on JSR-172 that doesn't use stubs.

Maybe you are looking for