0

I am supposed to retrieve data from mysql database at server from android mobile. I guess ksoap2 api would be suitable for it. I tried a lot, but found the enhanced copies of API's. Please refer me to the proper link of ksoap2 API, and also how to retrieve data.

4

2 に答える 2

0

すべてのユーザーをWebサービスから取得したい場合は、

public  String getAllUsers(String key)


 {

 dbase=new DatabaseActivity(this.adapterContext);


    String methodName = "GetUsers";


    SoapObject sUsers = new SoapObject(NAMESPACE, methodName);

    sUsers.addProperty("sKey", key);
   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(

            SoapEnvelope.VER11);





    envelope.setOutputSoapObject(sUsers);

    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    androidHttpTransport.debug = true;


    Users theUser = null;

    try {

        androidHttpTransport.call(SOAP_ACTION + methodName, envelope);



        SoapObject result = (SoapObject) envelope.getResponse();

 //---------------parse this result     

     }

ここで、名前空間はWebサービスのURLであり、メソッド名はアクセスする関数です。

于 2012-02-29T12:15:08.047 に答える
0

出力が xml 形式の場合は、Ksoap2 を使用できます。出力が json オブジェクトの場合は、JSON 解析を使用することをお勧めします。

php/mysql で Web サービスを使用していますか?

応答はどの形式で送信されますか?

于 2012-02-29T11:52:24.110 に答える