質問

接続しています... Webサービス、J2MEを使用したWebサービスを使用してSQL Serverですが、今度はHelloWorldを1つしています。ヌルムレ... パラメータはWebサービス、ここにWebサービスを受信しません。

[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"を返します。 Android、私はAndroidのために見ていますそれはSOO ...

PropertyInfo p1 = new PropertyInfo();
p1.setName("nombre");
p11.setValue("Angel");
busqueda.addProperty(p1);
.

しかしJ2MEのKSOAPはそれらのメソッドを持っていません。 "setName、setvalue"; このライブラリをダウンロードしましたが、私は醜いバグを入手し、アプリケーションは実行されません... これでパラメータが追加されているので、

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

しかしこれはうまくいかない... それはバグを持っていないが、Webサービスはパラメータを受け取らない...

スタックオーバーフローの人々に感謝します 私の英語はあまり良くない

役に立ちましたか?

解決

私はそれを解決した、それは秘密の書き込みです

envelope.dotNet=true;
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top