aspose file tools*
The moose likes Java Micro Edition and the fly likes j2me/ksoap error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "j2me/ksoap error" Watch "j2me/ksoap error" New topic
Author

j2me/ksoap error

kishani liyanage
Ranch Hand

Joined: Dec 08, 2003
Posts: 40
Hi,
>
> I'm new to J2ME and KSOAP, i downloaded libraries and sample from "kSOAP Download section" but they don't work!
> I copied ksoap-midp.zip and kxml2.zip (rename in .jar) to "lib" application directory, i compiled and ran the project, and when the application send the request, it stops work! Ktoolbar return the warning:
>
> Warning: To avoid potential deadlock, operations that may block, such as
> networking, should be performed in a different thread than the
> commandAction() handler.
>
> I tried StockQuoteDemo and CashConv.I use j2me 2.0. Please can someone give me a solution to this.
Thanks in advance.
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
You need to put network operations in a separate thread. You can start the thread from the "commandAction()" method.


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
Ould Nadif
Ranch Hand

Joined: Jan 21, 2004
Posts: 184
Yes, I agree with Michael.
Here a code to help you to create your thread:
if(command==ActionCommandxxx){


Thread t = new Thread() {
public void run() {
//open connecttion

};

//On lance le thread
t.start();

}


We are ones that build the world, thus build it well.
kishani liyanage
Ranch Hand

Joined: Dec 08, 2003
Posts: 40
I'm a beginner at j2me. Please if u could explain a little bit further on how i could do the network operation in a different thread and how i could start the thread from the "commandAction()" method i would be much grateful to u. Thanx a lot!
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
I think OULD has give you the exact code you need? If you want to see a complete example, check out an example MIDlet I had in the appendix of my book:
http://www.enterprisej2me.com/pages/enterprisej2me/codebrowser.php?req=//appendix01/SimpleDemo/src/com/enterprisej2me/simpledemo/DemoMIDlet.html
Also, I deleted your duplicated posts.
cheers
Michael
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: j2me/ksoap error