这是我的 Android main.java 我从这里调用 web 服务。但是我有一些问题,但我不知道哪个是失败的。我正在使用 android 调试器,但它在 transpor.call() 行中停止...
谢谢大家
package org.exa.prueba2android;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Main extends Activity {
private static final String accionSoap="http://CartaWS.restaurante.org/showItems";
private static final String Metodo = "showItems";
private static final String namespace="http://CartaWS.restaurante.org";
private static final String url="http://192.168.2.5:8080/CartaWSPrueba/services/CartaWS.CartaWSHttpSoap11Endpoint/";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView) findViewById(R.id.text);
try{
SoapObject request= new SoapObject(namespace, Metodo);
//modelo sobre
SoapSerializationEnvelope sobre = new SoapSerializationEnvelope(SoapEnvelope.VER11);
sobre.dotNet = true;
sobre.setOutputSoapObject(request);
HttpTransportSE transporte = new HttpTransportSE(url);
//LLAMADA
// **HERE IS THE PROBLEM**
transporte.call(accionSoap, sobre)`;
//Result
SoapPrimitive result = (SoapPrimitive)sobre.getResponse();
tv.setText("BEBIDAS: "+result.toString());
} catch (Exception e){}
}
}
我正在使用 Tomcat7、axis2、java、android、ksoap 2.6.1。Android 调试器停在这一行
transporte.call(accionSoap, sobre);
或者下一个
SoapPrimitive result = (SoapPrimitive)sobre.getResponse();
我是新来的,谢谢你所做的一切。