Solved

Necessary to include ksoap-midp.jar in MIDlet?

Posted on 2003-11-11
3
721 Views
Last Modified: 2013-11-18
Hi,

I am developing a MIDlet (using the J2ME Wireless Toolkit) that uses SOAP to access a web service that I have deployed.

My problem is that my MIDlet does not successfully build unless I include ksoap-midp.jar in its lib directory. The presence of that jar adds a whopping 41KB to my MIDlet which is otherwise very small.

Is there a way to get it to build without having to include the jar? Can I only remove any unnecessary class files from the jar to reduce its size?

FYI, my java file contains the following imports:
  import java.io.*;
  import javax.microedition.midlet.*;
  import javax.microedition.lcdui.*;
  import javax.microedition.io.*;
  import org.ksoap.*;
  import org.ksoap.transport.*;

Thanks for your help,
Brian
0
Comment
Question by:ghat1
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 125 total points
ID: 9727696
If your MIDlet relies on classes in the jar, then you have no option but to include it in the deployment.

You have already identified the best way to reduce this considerable overhead - remove unnecessary classes from the jar file.  This might be difficult unless you have the source code and the time to carefully extract all the parts you don't need.

The only other thing I can suggest is that you run a code obfuscator on it.

The freely available one that I use (retroguard) usually manages to shrink the code quite reasonably, but this is a fairly limited solution.  The main purpose of the obfuscator is to make your code more difficult to decompile by changing the names of classes/methods/attributes to less obvious names.  eg. DynamicSOAPAccessClient.class may be renamed to a.class.

The side-effect of this is a reduction in code size.

There are other obfuscators around (though I believe that you need to pay for most of them) that actively try to reduce the size of your code in addition to their primary function.

Try searching around with google for

java "code obfuscator"

530 links there ;-)
0
 

Author Comment

by:ghat1
ID: 9760621
I was hoping there would be another solution. Retroguard did reduce the code size (43KB -> 38KB ~ 10%) but thats not enough. I still find it hard to believe that any MIDlet using ksoap has to be atleast over 35KB.
Anyways, thanks for the help jimmack.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9762451
No problem ;-)

In the only system I've developed that used SOAP and J2ME, I did all the SOAP management on my server and just passed the relevant data to/from the handset using ordinary data streams.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Tired of waiting for your show or movie to load?  Are buffering issues a constant problem with your internet connection?  Check this article out to see if these simple adjustments are the solution for you.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now