Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 762
  • Last Modified:

Necessary to include ksoap-midp.jar in MIDlet?

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
ghat1
Asked:
ghat1
  • 2
1 Solution
 
jimmackCommented:
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
 
ghat1Author Commented:
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
 
jimmackCommented:
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now