我下载了并导入了jar包,添加了<uses-permission android:name="android.permission.INTERNET" /> 然后写了几行代码
private static String SOAP_ACTION = "http://www.youerw.com/ HelloWorld";
private static String NAMESPACE = "http://www.youerw.com/";
private static String METHOD_NAME = "HelloWorld";
private static String URL = "http: // 192.168.1.100:92 /MyWebService.asmx?WSDL";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Initialize soap request + add parameters
try
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
}
catch(Exception e)
{
String a = e.getMessage();
}
}
就这么几行简单的代码,一执行到SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);就出错,会说什么Source Not Found的错误:
// Compiled from InvocationTargetException.java (version 1.5 : 49.0, super bit)
Android开发环境ADT17 以后,要引用一个jar包,除了象之前添加引用后,还需要在Order and Export中选中这个包。
具体来说就是:选中工程->Java Build Path->选中标签Order and Export->选中没有找到的class的jar包或者包含的工程->点击OK。