Android WebService
Web Service简介
Web of Services refers to message-based design frequently found on the Web and in enterprise software. The Web of Services is based on technologies such as HTTP, XML, SOAP, WSDL, SPARQL, and others.
Web Service可以实现将服务器应用通过web开放给其他Web应用或其他平台调用。其实现的方式就是HTTP, XML, SOAP, WSDL等中介。
相关定义
SOAP
SOAP, originally an acronym for Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of web services in computer networks. It uses XML Information Set for its message format, and relies on other application layer protocols, most notably Hypertext Transfer Protocol (HTTP) or Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission.
WSDL
wsimport -s D:\\MyEclipse2015\\Workspaces\\TheClient\\src -p com.ithaibo.client -keep http://127.0.0.1:8080/Service/ServiceHello?wsdl
Demo
// 根据命名空间和方法得到SoapObject对象
SoapObject soapObject = new SoapObject(targetNameSpace,
getSupportProvince);
// 通过SOAP1.1协议得到envelop对象
SoapSerializationEnvelope envelop = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
// 将soapObject对象设置为envelop对象,传出消息envelop.dotNet = true;
envelop.setOutputSoapObject(soapObject);
// 或者envelop.bodyOut = soapObject;
HttpTransportSE httpSE = new HttpTransportSE(WSDL);
// 开始调用远程方法
try {
httpSE.call(targetNameSpace + getSupportProvince, envelop);
// 得到远程方法返回的SOAP对象
SoapObject resultObj = (SoapObject) envelop.getResponse();
// 得到服务器传回的数据
int count = resultObj.getPropertyCount();…
Android WebService的更多相关文章
- Android webservice的用法详细讲解
Android webservice的用法详细讲解 看到有很多朋友对WebService还不是很了解,在此就详细的讲讲WebService,争取说得明白吧.此文章采用的项目是我毕业设计的webserv ...
- xamarin for android webservice
首先新建一个空网站,添加一个webservice服务.然后在UserWebService.cs类里编写对外服务的方法 [WebMethod] public string IsCorret(string ...
- Android与服务器端数据交互(基于SOAP协议整合android+webservice)
http://www.cnblogs.com/zhangdongzi/archive/2011/04/19/2020688.html 上一节中我们通过http协议,采用HttpClient向服务器端a ...
- android webservice 成功版(帅哥)
package com.ts.xtweatherreport01;import java.io.UnsupportedEncodingException; import android.annotat ...
- Android调用天气预报的WebService简单例子
下面例子改自网上例子:http://express.ruanko.com/ruanko-express_34/technologyexchange5.html 不过网上这个例子有些没有说明,有些情况不 ...
- Android调用 Webservice报org.ksoap2.serialization.SoapPrimitive(转)
android Webservice开发的时候一般情况下大家接受webservice服务器返回值的时候都是使用SoapObject soapObject = (SoapObject) envelope ...
- Android使用webService
在android中使用webservice,首先要导入Android webservice支持包 ksoap2-android-assembly-3.3.0-jar-with-dependencies ...
- Android 用webService产生java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive错误的解决(转)
在做android Webservice开发的时候一般情况下大家接受webservice服务器返回值的时候都是使用 SoapObject soapObject = (SoapObject) enve ...
- 6、android 网络编程
1.基于socket的用法 服务器端: 先启动一个服务器端的socket ServerSocket svr = new ServerSocket(8989); 开始侦听请求 Socket s ...
随机推荐
- TelephonyManager类与PhoneStateListener
public class TelephonyManager extends Object java.lang.Object android.telephony.TelephonyManage ...
- [转]C#压缩打包文件
/// <summary> /// 压缩和解压文件 /// </summary> public class ZipClass { /// <summary> /// ...
- 工作随笔——Intellij_idea-14官方快捷键中文版
听说Intellij Idea好几年了.因为快捷键的原因,所以一直没有放弃eclipse.上周末抽了点时间,用google翻译+自己实践翻译了一下官方的快捷键. 基本做完的时候在百度文库上突然搜索到一 ...
- RabbitHub开源情况及计划
之前写过一篇".NET 平台下的插件化开发内核(Rabbit Kernel)",已经过去三个月了,期间RabbitHub并不是没有了发展更不是放弃了发展,在RabbitHub中的群 ...
- NDK开发之javaVM
1.关于JNIEnv和JavaVM JNIEnv是一个与线程相关的变量,不同线程的JNIEnv彼此独立.JavaVM是虚拟机在JNI层的代表,在一个虚拟机进程中只有一个JavaVM,因此该进程的所有线 ...
- Word Excel 操作总结
1.与office无关使用 Aspose.Cells.dll,Aspose.Words.dll 2.使用Microsoft.Office.Interop.Excel Microsoft.Office. ...
- Eclipse利用Maven2搭建SpringMVC框架的Web工程
一.准备工作: 下载apache-maven--> 配置Maven_home -->下载Eclipse Maven插件 二.新建工程: 选择新建Maven Project arche ...
- android之自定义广播
布局文件 点击按钮发送广播 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmln ...
- [AJAX系列]onreadystatechange事件
onreadystatechange事件: 当请求被发送到服务器时,我们需要执行一些基于响应的任务 每当readyState改变时,就会触发onreadystatechange事件 readyStat ...
- DatePicker及其监听
xml文件: <DatePicker android:id="@+id/datep" android:layout_width="wrap_content" ...