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:代表服务器错误