开发者

ksoap connection with web service, no android (using ksoap)

开发者 https://www.devze.com 2023-02-19 21:56 出处:网络
well i am doing a connection... sql server with web service, web service with j2me, but now i am doing one helloworld...i could it, but now than i want to do one \"hello world \"+nombre...

well i am doing a connection... sql server with web service, web service with j2me, but now i am doing one helloworld...i could it, but now than i want to do one "hello world "+nombre... parameter is not receive in web service, here the web service

[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;
    }

}

and this is the code for call it with 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);

}


}

i get it returns "que onda " with a space, because so i put it in web service, but never it returns "que onda "+nombre ... it is a application for j2me not for android, i watch for android it is soo...

PropertyInfo p1 = new PropertyInfo();
p1.setName("nombre");
p11.setValue("Angel");
busqueda.addProperty(p开发者_如何学运维1);

but ksoap for j2me doesn't have those methods.. "setName, setValue"; i have downloades this library but i get a ugly bug and application doesn't run... with this i see parameter is added so..

 busqueda.addProperty("nombre","Angel");

but this it doesn't work... it does run it doesn't have any bug, but web service never receive the parameter...

thank you people of STACKOVERFLOW my english is not very well sorry


i solved it, it is necesary write

envelope.dotNet=true;
0

精彩评论

暂无评论...
验证码 换一张
取 消