在调用Ksoap2时在android中调试时遇到BaseClassLoader.Class未找到运行时错误
我正在使用EclipseHelios开发android应用程序。 我制作了一个.NETWeb服务,然后制作了一个android应用程序,在其中我使用Ksoap2 jar文件调用web服务。 我查看此链接以获取帮助 我下载了带有依赖项的android ksoap2.jar文件 然后使用构建路径添加jar文件 一切进展顺利,但每当我运行或调试应用程序时,它都会给我一个错误 随叫随到的soap方法 BaseClassLoader.Class Not found错误请附加源 在日志cat中,无法找到类org.ksoap2.serialization。Soap对象,即使该类存在于库中在调用Ksoap2时在android中调试时遇到BaseClassLoader.Class未找到运行时错误,android,android-ksoap2,Android,Android Ksoap2,我正在使用EclipseHelios开发android应用程序。 我制作了一个.NETWeb服务,然后制作了一个android应用程序,在其中我使用Ksoap2 jar文件调用web服务。 我查看此链接以获取帮助 我下载了带有依赖项的android ksoap2.jar文件 然后使用构建路径添加jar文件 一切进展顺利,但每当我运行或调试应用程序时,它都会给我一个错误 随叫随到的soap方法 BaseClassLoader.Class Not found错误请附加源 在日志cat中,无法找到类o
This is my soap class
package com.nrf;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
public class CallSoap
{
public String SOAP_ACTION;
public String OPERATION_NAME;
public final String WSDL_TARGET_NAMESPACE = "NRF_Cargo_App";
public final String SOAP_ADDRESS = "http://localhost:5265/NRF_Cargo_Service.asmx";
public CallSoap()
{
}
public String Call(String a,String b)
{
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
PropertyInfo pi = new PropertyInfo();
pi.setName("userName");
pi.setValue(a);
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("Password");
pi.setValue(b);
pi.setType(String.class);
request.addProperty(pi);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
Object response=null;
try
{
httpTransport.call(SOAP_ACTION, envelope);
response = envelope.getResponse();
}
catch (Exception exception)
{
response=exception.toString();
}
return response.toString();
}
}
This is my MainActivityclass
package com.nrf;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity
{
Button btnlogin;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnlogin = (Button) findViewById(R.id.btnsign);
btnlogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
CallSoap cs = new CallSoap();
cs.OPERATION_NAME = "UserLogin";
cs.SOAP_ACTION ="NRF_Cargo_App/UserLogin";
String resp=cs.Call("Numair", "1234");
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Please help me for making this app run
or suggest me another easy way of calling .net web-service in android.Thanks
对于错误日志Cat
试试这个:
右键单击已导入-->确定的项目-->转到构建路径-->配置构建路径-->内部订单和导出标记检查库
然后清理您的项目。我尝试过多次这种方法。没有成功。我可以给您我的项目样本,您可以自己尝试。