0

I am trying to use a .NET service in Android Application using the ksoap2 library. I added the reference to the jar of ksoap2-android-assembly-2.6.5-jar-with-dependencies in my project. But when I run the code I get a runtime exception saying

java.lang.NoClassDefFound : org.ksoap2.serialization.SoapObject.

Can anyone please help ? This is my code.

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    SoapSerializationEnvelope envelope = 
        new SoapSerializationEnvelope(SoapEnvelope.VER11); 
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);


    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
        tvTemp.setText("Received :" + resultsRequestSOAP.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
Swayam
  • 16,294
  • 14
  • 64
  • 102

1 Answers1

0

I solved the problem using the link provided by the first commentator on the question. I am leaving the answer here just in case another programmer faces the same problem and comes across my question.

The solution to this problem is to create a folder named "libs" in the project directory and copying all the external jar files there.

For further explanation, one can refer to this link. http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

Swayam
  • 16,294
  • 14
  • 64
  • 102