• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in connecting web service from j2me

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am a newbie to J2ME. I did not get any step by step guidelines to connect to a web service using j2me. After searching a lot, Based on some example, I tried to connect a webservice using j2me midlet.

It is giving "java.lang.NoClassDefFoundError: org/ksoap/SoapObject" error, even though I have included ksoap-j2se.jar also in buildpath(download from http://ksoap.objectweb.org/software/downloads/)

please help me. Thanks for your help in advance.

##############################################################
here is the program
##############################################################
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
import javax.microedition.io.*;

import org.ksoap.*;
import org.ksoap.transport.*;
import org.ksoap.SoapObject;

public class testWebService extends MIDlet {

private Display display;
private String url = "http://172.16.25.149/FPSTCService/STC.asmx";
TextBox textBox = null;
private Command cmExit;

public testWebService()
{
display = Display.getDisplay(this);

}

public void startApp() {
try
{
doWebService(url);
}
catch(Exception e)
{
System.out.println("Exception: " + e);
}

}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
destroyApp(false);
notifyDestroyed();
}


public void doWebService(String url) throws Exception
{
StringBuffer sb = new StringBuffer();
TextBox textBox = null;

SoapObject client = new SoapObject("http://tempuri.org/", "checkLogin");
client.addProperty("Username","sgonsite");
client.addProperty("Password","Test123");
client.addProperty("DeviceId", "2237951d");



HttpTransportSE ht = new HttpTransportSE(url, "checkLogin");
sb.append("" + ht.call(client));
System.out.println("here is output ----- " + client.getNamespace());


textBox = new TextBox("Simple Web Service Test: ", sb.toString(), 1024, 0);
display.setCurrent(textBox);
}

}
##############################################################

Here is the error
##############################################################

Running with storage root C:\Users\srikanthnagachandm\j2mewtk\2.5.2\appdb\DefaultColorPhone
Running with locale: English_United States.1252
Running in the identified_third_party security domain
java.lang.NoClassDefFoundError: org/ksoap/SoapObject
at testWebService.doWebService(+10)
at testWebService.startApp(+8)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
Execution completed.
3407637 bytecodes executed
26 thread switches
1669 classes in the system (including system classes)
17711 dynamic objects allocated (532164 bytes)
3 garbage collections (459628 bytes collected)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic