Solved

Necessary to include ksoap-midp.jar in MIDlet?

Posted on 2003-11-11
3
732 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This subject  of securing wireless devices conjures up visions of your PC or mobile phone connecting to the Internet through some hotspot at Starbucks. But it is so much more than that. Let’s look at the facts: devices#sthash.eoFY7dic.
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.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

726 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