Solved

Necessary to include ksoap-midp.jar in MIDlet?

Posted on 2003-11-11
3
729 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using in-flight Wi-Fi when you travel? Business travelers beware! In-flight Wi-Fi networks could rip the door right off your digital privacy portal. That’s no joke either, as it might also provide a convenient entrance for bad threat actors.
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.
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.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

734 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