Solved

Necessary to include ksoap-midp.jar in MIDlet?

Posted on 2003-11-11
3
717 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.

772 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

10 Experts available now in Live!

Get 1:1 Help Now