java.lang.NoClassDefFoundError: javax.microedition.io.Connector
I am trying to consume a .net web service, and get the following error when I run it(debug) from my phone
java.lang.NoClassDefFoundError: javax.microedition.io.Connector
I get the error when I make the call to the transport object
ht.call(SOAP_ACTION, soapEnvelope);
while in the eclipse ide, the (context sensitive model) does not show this in the object model when i try to add it i only see javax.microedition.khronos.* , no javax.microedition.io, which confuses me more.
When I try to debug this in the emulator, I only get a VerifyError
private static final String SOAP_ACTION = "http://ikonicsoft.com/CheckTrial";
private static final String METHOD_NAME = "CheckTrial";
private static final String NAMESPACE = "http://ikonicsoft.com";
private static final String URL = "ht开发者_高级运维tp://ikonicsoft.com/WebService.asmx";
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
request.addProperty("deviceid", deviceid);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(request);
HttpTransport ht = new HttpTransport(URL);
Boolean bValid = false;
try{
ht.call(SOAP_ACTION, soapEnvelope);
Boolean result = (Boolean) soapEnvelope.getResponse();
if((Boolean)result){
bValid = true;
}else{
bValid = false;
}
}catch(Exception e){
e.printStackTrace();
bValid = false;
}
let me know if you need more info
thanks in advance
patrick
Ok, it helps to download and install the correct ksoap2 package. I found the correct package for android development at:
ksoap2-android-assembly-2.4-jar-with-dependencies.jar
The Android SDK does not provide the javax.microedition.io
package. Take a look of this for further reference: Package Index
I had a similar problem where Android Studio could not recognize all my org.ksoap2
imports. It was solved by restarting Android Studio.
精彩评论