0
以及我正在做一個連接...與web服務,j2me的web服務的sql服務器,但現在我正在做一個helloworld ...我可以,但現在比我想要做一個「世界你好」 +農佈雷... 參數不在網絡服務接收,這裏的Web服務ksoap與web服務連接,沒有android(使用ksoap)
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// Para permitir que se llame a este servicio web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la línea siguiente.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service() {
}
[WebMethod]
public string HelloWorld(String nombre)
{
return "Que onda " + nombre;
}
}
,這是與KSOAP調用它的代碼...
String nombremetodo="HelloWorld";
String url="http://localhost:49175/WebSite1/Service.asmx";
String namespace="http://tempuri.org/";
String SOAP_ACTION=namespace+nombremetodo;
public void traer()
{
SoapObject busqueda =new SoapObject(namespace,nombremetodo);
HttpTransport transportacion = new HttpTransport(url);
busqueda.addProperty(new String("nombre"),new String("Angel"));
System.out.println("parametro agregado");
//busqueda.addProperty(PropertyInfo.OBJECT_TYPE, "Angel");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
transportacion.debug=true;
envelope.bodyOut=busqueda;
System.out.println("todo ok");
try{
System.out.println("comenzando transportacion");
transportacion.call(SOAP_ACTION, envelope);
System.out.println("transportacion ok");
respuesta = envelope.getResponse().toString();
System.out.println("respuesta ok");
}
catch(Exception e)
{
texto.setString("fallo");
System.out.println("falla en el try");
System.out.println(e);
}
}
我得到它返回「que onda」的空間,因爲所以我把它放在web服務中,但從不返回「que昂達「+農佈雷......它不是 機器人爲J2ME應用程序一個,我看的Android是洙......
PropertyInfo p1 = new PropertyInfo();
p1.setName("nombre");
p11.setValue("Angel");
busqueda.addProperty(p1);
但KSOAP爲J2ME沒有這些方法..」的setName,設定值」; 我有downloades這個庫,但我得到一個醜陋的錯誤,應用程序不能運行...... 有了這個,我看參數添加這樣..
busqueda.addProperty("nombre","Angel");
但它不工作... 它不運行它沒有任何錯誤,但Web服務從未接收參數...
謝謝計算器 的人我的英語不是非常好後悔