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的更多相关文章

  1. Android webservice的用法详细讲解

    Android webservice的用法详细讲解 看到有很多朋友对WebService还不是很了解,在此就详细的讲讲WebService,争取说得明白吧.此文章采用的项目是我毕业设计的webserv ...

  2. xamarin for android webservice

    首先新建一个空网站,添加一个webservice服务.然后在UserWebService.cs类里编写对外服务的方法 [WebMethod] public string IsCorret(string ...

  3. Android与服务器端数据交互(基于SOAP协议整合android+webservice)

    http://www.cnblogs.com/zhangdongzi/archive/2011/04/19/2020688.html 上一节中我们通过http协议,采用HttpClient向服务器端a ...

  4. android webservice 成功版(帅哥)

    package com.ts.xtweatherreport01;import java.io.UnsupportedEncodingException; import android.annotat ...

  5. Android调用天气预报的WebService简单例子

    下面例子改自网上例子:http://express.ruanko.com/ruanko-express_34/technologyexchange5.html 不过网上这个例子有些没有说明,有些情况不 ...

  6. Android调用 Webservice报org.ksoap2.serialization.SoapPrimitive(转)

    android Webservice开发的时候一般情况下大家接受webservice服务器返回值的时候都是使用SoapObject soapObject = (SoapObject) envelope ...

  7. Android使用webService

    在android中使用webservice,首先要导入Android webservice支持包 ksoap2-android-assembly-3.3.0-jar-with-dependencies ...

  8. Android 用webService产生java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive错误的解决(转)

    在做android  Webservice开发的时候一般情况下大家接受webservice服务器返回值的时候都是使用 SoapObject soapObject = (SoapObject) enve ...

  9. 6、android 网络编程

    1.基于socket的用法 服务器端: 先启动一个服务器端的socket     ServerSocket svr = new ServerSocket(8989); 开始侦听请求 Socket s  ...

随机推荐

  1. android错误之MediaPlayer用法的Media Player called in state *,androidmediaplayer

    用到Media Player,遇到几个问题,记一下 用法就不说了,使用的时候最好参考一下mediaPlayer的这张图 第一个错误是Media Player called in state 8 这个是 ...

  2. java:如何让程序按要求自行重启?

    正文开始前的废话: 这里的程序即包括b/s的web application,也包括standalone的类c/s的java application.   为什么要自我重启?   场景1:分布式环境中, ...

  3. Autofac中的属性注入功能使用

    使用依赖注入容器时,大部分都是使用构造函数来注入或者是xml配置文件.也有很多支持属性注入.Autofac就是其中一个. 1 为什么要有属性注入? 对于一些使用特频繁的类或者方法,很多类都会用到,那么 ...

  4. Jenkins进阶系列之——18Jenkins语言本地化

    在Jenkins中,英语一大片,看着各种蛋疼.非常高兴的是,Jenkins作为一个主流流行的持续构建工具,提供了一个本地化语言的配置界面. 你可以找到它,在Jenkins每页的左下角.如下图: 点击帮 ...

  5. 获取图片base64编码的几种方法

    前文中我们聊了 Data URI 和 base64编码,稍微回顾下.base64编码 是将数据用 64 个可打印的字符进行编码的方式,任何数据底层实现都是二进制,所以都可以进行 base64编码,ba ...

  6. 边界网关协议BGP

    Border Gateway Protocol (BGP) is a standardized exterior gateway protocol designed to exchange routi ...

  7. 解决"415 Cannot process the message because the content type 'application/x-www-form-urlencoded' was not the expected type 'text/xml; charset=utf-8'"

    wcf basicHttpBinding content-type    text/xml;charset=utf-8 wsHttpBinding  'application/soap+xml; ch ...

  8. Maven的set.xml标签详解

    文件存放位置 全局配置: ${M2_HOME}/conf/settings.xml 用户配置: ${user.home}/.m2/settings.xml note:用户配置优先于全局配置.${use ...

  9. android 点亮屏幕与锁定屏幕

    PowerManager pm=(PowerManager) getSystemService(Context.POWER_SERVICE); //获取电源管理器对象 PowerManager.Wak ...

  10. swift项目实战--微博的未登录界面的实现,和监听未登录界面两个按钮的两种实现方法

    1.未登录界面的实现 微博项目中,用户不登录的话,显示的是未登录的界面.项目中TabBarVC的子控制器都是tableViewVC,所以抽取了父类,让父类判断用户是否登录,决定显示什么样的界面.loa ...