1
私はアンドロイドが初めてです。私はアンドロイドからwebserviceに接続する必要があります。 webserviceメソッドは、10MB以上の文字列値を返します。私はKSOAPを使用しようと考えました。誰かが私に、アンドロイドからKSOAPを使用してSOAP Webサービスに接続する短い例を教えてもらえますか?KSoapを使ってアンドロイドからWebサービスに接続
私はアンドロイドが初めてです。私はアンドロイドからwebserviceに接続する必要があります。 webserviceメソッドは、10MB以上の文字列値を返します。私はKSOAPを使用しようと考えました。誰かが私に、アンドロイドからKSOAPを使用してSOAP Webサービスに接続する短い例を教えてもらえますか?KSoapを使ってアンドロイドからWebサービスに接続
あなたは何をグーグルでしたahaaaa
public class Connection extends AsyncTask<Void,Void,Void> {
@Override
protected Void doInBackground(Void... params) {
String SOAP_ACTION = "http://www.example.com/Get/GetCount";
String METHOD_NAME = "GetCount";
String NAMESPACE = "http://www.example.com";
String URL = "http://www.example.com/Get.php?wsdl";
String Result;
SoapObject request1 = new SoapObject(NAMESPACE, METHOD_NAME);
request1.addProperty("AppId", 1);
SoapSerializationEnvelope envelope = new soapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true; envelope.setOutputSoapObject(request1);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true; try {
//this is the actual part that will call the webservice
androidHttpTransport.call(soapaction, envelope);
}
catch (IOException e) {
e.printStackTrace(); }
catch (XmlPullParserException e)
{ e.printStackTrace(); }
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject)envelope.bodyIn;
Result = result.getProperty(0).toString();
JSONObject jArray = new JSONObject(Result);
JSONArray Count = jArray.getJSONArray("Details");
ArrayList<HashMap<String, String>> myList = new ArrayList<HashMap<String, String>>();
for(int i=0;i < Count .length();i++){
HashMap<String, String> map = new HashMap<String, String>();
JSONObject e = Count .getJSONObject(i);
map.put("id", e.getString("ID"));
myList.add(map);
}
}
をKSOAP jarファイルを追加し、Webサービスのための非同期メソッドを使うのか?すでに多くの例があります。 –
これに 'Json'を使うことをお勧めします。その軽量で、簡単で高速です。 – waqaslam
私は10MB以上のファイルを読み込んで再生するシンプルなアプリケーションが必要です。出来ますか? (メモリにファイルをロードして再生して返します) – user1222905