android訪問wcf
Ⅰ Android與WCF傳輸數據類型Wcf如果不拼XML,不做序列化!手機怎麼與之交互
我的方案是:中間建立一個代理網站, android 訪問代理網站,代理網站調用WCF,將WCF返回的數據序列化成json返回給android。
代理網站可以採用1. asp.net WebForm, 2. asp.net webAPI
當採用WebForm,安卓訪問url.aspx,參數通過url QueryString傳遞, 頁面WCF返回結果直接寫入相應流中。
當採用webAPI,這個相對復雜點,還要處理跨域,驗證等問題。而且還要ASP.NET MVC 4才支持。
Ⅱ 如何搭建android客戶端的伺服器端
建議你可以用webservice做服務端 如果資源較大的話 可以用ftp來做服務端 android有很多ftp客戶端的代碼 你可以參考一下 做業務類的字元類的數據 就用json編碼的webservice 或者是目前比較流行的wcf服務端 網路一下一大堆
Ⅲ android開發中,如何連接伺服器,從伺服器讀取到數據
伺服器端生成JSON:
使用HttpURLConnection連接,通過JSON格式傳遞對象數據
java"> URLurl=newURL(urlpath);
HttpURLConnectionconn=(HttpURLConnection)url.openConnection();
InputStreaminStream=conn.getInputStream();
=newByteArrayOutputStream();
byte[]data=newbyte[1024];
intlen=0;
while((len=inStream.read(data))!=-1){
outStream.write(data,0,len);
System.out.println(len);
}
inStream.close();
byte[]rlt=outStream.toByteArray();
returnnewString(rlt);
Ⅳ Android客戶端如何連接到資料庫伺服器,請指明學習內容,謝謝!
通過webservice 連接,網路下很多
Ⅳ 如何發送多個參數,從 android 到 wcf 伺服器使用 ksoap2
若要發送多個參數、 字元串、 整數,等等:
SoapObject request = new SoapObject(NAMESPACE, METHOD);
PropertyInfo variableHeight = new PropertyInfo();
variableHeight.setName("height");
variableHeight.setValue(value); // your variable value
variableHeight.setType(Integer.class); // if its string type change to String.class
request.addProperty(variableHeight);
PropertyInfo variableWidth = new PropertyInfo();
variableWidth.setName("width");
variableWidth.setValue(value);
variableWidth.setType(Integer.class);
request.addProperty(variableWidth);
但用於發送位元組數組我不太清楚,看看這個: http://code.google.com/p/ksoap2-android/issues/detail?id=116
Ⅵ android請求wcf服務提交數據是response.getstatusline.getstatuscode的值為40
response.getStatusCode()==200:代表請求成功
response.getStatusCode()==303:代表重定向
response.getStatusCode()==400:代表請求錯誤
response.getStatusCode()==401:代表未授權
response.getStatusCode()==403:代表禁止訪問
response.getStatusCode()==404:代表文件未找到
response.getStatusCode()==500:代表伺服器錯誤