Forums Register Login

Problem in connecting web service from j2me

+Pie Number of slices to send: Send
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)
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1862 times.
Similar Threads
J2MEWTK 1.0.3 HTTP Connection
Ksoap / j2me / .Net Web Service
web service client in j2se
Where do the CLDC class files need to be placed?
Compile
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 00:37:23.