⑴ http接口和webservice接口的区别
web service(SOAP)与HTTP接口的区别
什么是web service? soap请求是HTTP POST的一个专用版本,遵循一种特殊的xml消息格式Content-type设置为: text/xml任何数据都可以xml化。
  
为什么要学习web service? 大多数对外接口会实现web service方法而不是http方法,如果你不会,那就没有办法对接。
 
web service相对http (post/get)有好处吗?
 
1.接口中实现的方法和要求参数一目了然
 
2.不用担心大小写问题
 
3.不用担心中文urlencode问题
 
4.代码中不用多次声明认证(账号,密码)参数
 
5.传递参数可以为数组,对象等...
web service相对http(post/get)快吗?
 
由于要进行xml解析,速度可能会有所降低。
 
 web service 可以被http(post/get)替代吗?
 
完全可以,而且现在的开放平台都是用的HTTP(post/get)实现的。
⑵ 请问什么是web接口请具体点。
类接口是给别的类实现的。service接口的面向用户开放的,比如用户需要什么程序数据,他访问这个接口,程序返回他要的数据。webservice服务android比较多
⑶ web接口包括http接口吗
web service(SOAP)与HTTP接口的区别
什么是web service? soap请求是HTTP POST的一个专用版本,遵循一种特殊的xml消息格式Content-type设置为: text/xml任何数据都可以xml化。
为什么要学习web service? 大多数对外接口会实现web service方法而不是http方法,如果你不会,那就没有办法对接。
web service相对http (post/get)有好处吗?
1.接口中实现的方法和要求参数一目了然
2.不用担心大小写问题
3.不用担心中文urlencode问题
4.代码中不用多次声明认证(账号,密码)参数
5.传递参数可以为数组,对象等...
web service相对http(post/get)快吗?
由于要进行xml解析,速度可能会有所降低。
web service 可以被http(post/get)替代吗?
完全可以,而且现在的开放平台都是用的HTTP(post/get)实现的。
⑷ 怎么规范的开发webservice接口
以下是操作步骤:
1、编写服务代码
服务代码提供了两个函数,分别为sayHello和sayHelloToPerson,在HelloService.java类中
2、发布WebService
要将上边写的HelloService类发布为WebService,需要先搭建Web应用。下面是在Tomcat下使用Axis创建WebService服务的例子。
3、在Tomcat下创建Web应用
在该例子中,在Tomcat下创建了一个context path为test_webservice的WEB应用。
(1) 在Tomcat的webapps下创建如下文件系统
test_webservice
WEB-INF
lib
Classes
(2)在WEB-INF文件夹下创建web.xml文件,在web.xml中主要是配置axis。
4、复制axis相关的jar文件
将axis的相关jar文件复制到WEB-INF\lib文件夹下。这些文件包括:
activation.jar
axis.jar
axis-ant.jar
axis-schema.jar
commons-discovery-0.2.jar
commons-logging-1.0.4.jar
jaxrpc.jar
log4j-1.2.8.jar
mailapi.jar
saaj.jar
wsdl4j-1.5.1.jar
xmlsec-1.3.0.jar    
5、测试发布的WEB应用 
启动Tomcat服务,打开IE浏览器,访问http:host:port/test_webservice/services,
如果看到如下界面就说明AXIS部署成功了。 
6、发布WebService
发布WebService需要使用现有的AdminService来实现,这里我写了一个批处理文件来发布WebService,以后如果需要发布其他文件,只需要修改相应的参数就可以了。
(1)创建deploy.wsdd文件。
(2)创建发布WebService服务的批处理文件deploywebservice.bat。
其中E:\workspace\Libwebservice是存放axis对应的jar文件的文件夹,现在将所有的jar文件都加入到此文件夹中。
-l后的参数是本地要发布WebService的AdminService对应的访问地址。
最后deploy.wsdd是对应的配置文件名称。
(3) 将deploy.wsdd文件和deploywebservice.bat文件复制到同一个文件夹下,执行deploywebservice.bat批处理文件,就可以将deploy.wsdd中描述的Java类发布为WebService。发布完成之后再访问http://host:port/test_webservice/services
⑸ webservice接口怎么使用
webservice的调用,常用的大约有3种方式:
    1、使用axis调用
    2、使用xfire调用
    3、使用cxf调用
    项目中,采用axis进行调用,记录如下,备忘:
    ps教程:想当年的时候是用的xfire方式调用的,结果没做记录,现在已经完全记不得怎么玩了。所以说要多写博客啊 t_t
   版本说明:
        aixs版本:axis-bin-1_4.zip
        java环境略
    第一步:确保wsdl文件可用,文中为获取到sendsmsservice.wsdl,当然url的也行。
    第二步:执行生成客户端代码的脚本。脚本内容为:
set axis_lib=d:axis-1_4lib
set java_cmd=java -djava.ext.dirs=%axis_lib%
set output_path=.
set package=info.jyzh.wap.liaoning.push
%java_cmd% org.apache.axis.wsdl.wsdl2java sendsmsservice.wsdl -o%output_path% -p%package% -t
 
#查看wsdl2java的使用帮助#%java_cmd% org.apache.axis.wsdl.wsdl2java -help
 
ok,至此,客户端代码就生成出来了。还带了一个单元测试哦。
 
实际工作中,碰到以下情况,客户端不能直接连上webservice服务器,中间被强大的代理服务器挡住了。如下图:
为此,修改生成的代码,本次是在中作修改,如下:
    static {
            axisproperties.setproperty("http.proxyhost","88.88.88.88");
            axisproperties.setproperty("http.proxyport","8080");
            axisproperties.setproperty("http.proxyuser","asp教程yy");
            axisproperties.setproperty("http.proxypassword","123456");
        _operations = new org.apache.axis.description.operationdesc[1];
        _initoperationdesc1();
    }直接axis调用远程的web service我觉得这种方法比较适合那些高手,他们能直接看懂xml格式的wsdl文件,我自己是看不懂的,尤其我不是专门搞这行的,即使一段时间看懂,后来也就忘记了。直接调用模式如下:import java.util.date;import java.text.dateformat;import org.apache.axis.client.call;import org.apache.axis.client.service;import javax.xml.namespace.qname;import java.lang.integer;import javax.xml.rpc.parametermode; public class caclient {                   public static void main(string[] args) {               try {                     string endpoint = "http://localhost:8080/ca3/services/casynrochnized?wsdl";                     //直接引用远程的wsdl文件                    //以下都是套路 
                     service service = new service();                     call call = (call) service.createcall();                     call.settargetendpointaddress(endpoint);                     call.setoperationname("adser");//wsdl里面描述的接口名称                     call.addparameter("username", org.apache.axis.encoding.xmltype.xsd_date,                                   javax.xml.rpc.parametermode.in);//接口的参数                     call.setreturntype(org.apache.axis.encoding.xmltype.xsd_string);//设置返回类型 
                     string temp = "测试人员";                     string result = (string)call.invoke(new object[]{temp});                     //给方法传递参数,并且调用方法                     system.out.println("result is "+result);              }              catch (exception e) {                     system.err.println(e.tostring());              }       }}2,直接soap调用远程的webservice这种模式我从来没有见过,也没有试过,但是网络上有人贴出来,我也转过来import org.apache.soap.util.xml.*;import org.apache.soap.*;import org.apache.soap.rpc.*; import java.io.*;import java.net.*;import java.util.vector; public class caservice{       public static string getservice(string user) {       url url = null;       try {           url=new url("http://192.168.0.100:8080/ca3/services/casynrochnized");       } catch (malformerlexception mue) {          return mue.getmessage();         }             // this is the main soap object       call soapcall = new call();       // use soap encoding       soapcall.setencodingstyleuri(constants.ns_uri_soap_enc);       // this is the remote object we're asking for the price       soapcall.settargetobjecturi("urn:xmethods-casynrochnized");       // this is the name of the method on the above object       soapcall.setmethodname("getuser");       // we need to send the isbn number as an input parameter to the method       vector soapparams = new vector();        // name, type, value, encoding style       parameter isbnparam = new parameter("username", string.class, user, null);       soapparams.addelement(isbnparam);       soapcall.setparams(soapparams);       try {          // invoke the remote method on the object          response soapresponse = soapcall.invoke(url,"");          // check to see if there is an error, return "n/a"          if (soapresponse.generatedfault()) {              fault fault = soapresponse.getfault();             string f = fault.getfaultstring();             return f;          } else {             // read result             parameter soapresult = soapresponse.getreturnvalue ();             // get a string from the result             return soapresult.getvalue().tostring();          }       } catch (soapexception se) {          return se.getmessage();       }    }}
3,使用wsdl2java把wsdl文件转成本地类,然后像本地类一样使用,即可。
⑹ webService接口是什么
Web是使应用程序可以与平台和编程语言无关的方式进行相互通信的一项技术。Web 服务是一个软件接口,它描述了一组可以在网络上通过标准化的 XML 消息传递访问的操作。
它使用基于 XML 语言的协议来描述要执行的操作或者要与另一个 Web 服务交换的数据。一组以这种方式交互的 Web 服务在面向服务的体系结构(Service-Oriented Architecture,SOA)中定义了特殊的 Web 服务应用程序。
简单的说WebService是一个SOA(面向服务的编程)的架构,它是不依赖于语言,不依赖于平台,可以实现不同的语言(通过xml描述)间的相互调用,通过Internet进行基于Http协议的网络应用间的交互。
通过SOAP在Web上提供的软件服务,使用WSDL文件进行说明,并通过UDDI进行注册。

(6)web接口扩展阅读
Web Service技术, 能使得运行在不同机器上的不同应用无须借助附加的、专门的第三方软件或硬件, 就可相互交换数据或集成。
依据Web Service规范实施的应用之间, 无论它们所使用的语言、 平台或内部协议是什么, 都可以相互交换数据。Web Service是自描述、 自包含的可用网络模块, 可以执行具体的业务功能。
web广泛用到的技术:
TCP/IP:通用网络协议,被各种设备使用
HTML(标准通用标记语言下的一个应用):通用用户界面,可以使用HTML标签显示数据
NET: 不同应用程序间共享数据与数据交换
Java:写一次可以在任何系统运行的通用编程语言,因为java具有跨平台特性
XML(标准通用标记语言下的一个子集):通用数据表达语言,在web上传送结构化数据的容易方法
⑺ API接口与webservice接口的区别
1. webservice走HTTP协议和80端口。
2. 而你说的api,用的协议和端口,是根据开发人员定义的。
3. 这么说吧,api类似于cs架构,需要同时开发客户端API和服务器端程序。
4. 而WebService则类似于bs架构,只需要开发服务器端,不需要开发客户端,客户端只要遵循soap协议,就可以调用。
⑻ java怎样提供webservice接口
Java通过WSDL文件来调用webservice:
注意,以下的代码并没有经过真正的测试,只是说明这些情况,不同版本的Axis相差很大,大家最好以apache网站上的例子为准,这里仅仅用于说明其基本用法。 
1,直接AXIS调用远程的web service
这种方法比较适合那些高手,他们能直接看懂XML格式的WSDL文件,我自己是看不懂的,尤其我不是专门搞这行的,即使一段时间看懂,后来也就忘记了。直接调用模式如下:
import java.util.Date;
import java.text.DateFormat;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.lang.Integer;
import javax.xml.rpc.ParameterMode;
public class caClient {
public static void main(String[] args) {
try {
String endpoint = "http://localhost:8080/ca3/services/caSynrochnized?wsdl";
//直接引用远程的wsdl文件
//以下都是套路
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName("addUser");//WSDL里面描述的接口名称
call.addParameter("userName", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);//接口的参数
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型  
String temp = "测试人员";
String result = (String)call.invoke(new Object[]{temp});
//给方法传递参数,并且调用方法
System.out.println("result is "+result);
}
catch (Exception e) {
System.err.println(e.toString());
}
}
}
2,直接SOAP调用远程的webservice
这种模式我从来没有见过,也没有试过,但是网络上有人贴出来,我也转过来 
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import java.io.*;
import java.net.*;
import java.util.Vector;
public class caService{
public static String getService(String user) {
URL url = null;
try {
url=new URL("http://192.168.0.100:8080/ca3/services/caSynrochnized");
} catch (MalformedURLException mue) {
return mue.getMessage();
}
// This is the main SOAP object
Call soapCall = new Call();
// Use SOAP encoding
soapCall.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
// This is the remote object we're asking for the price
soapCall.setTargetObjectURI("urn:xmethods-caSynrochnized");
// This is the name of the method on the above object
soapCall.setMethodName("getUser");
// We need to send the ISBN number as an input parameter to the method
Vector soapParams = new Vector();
// name, type, value, encoding style
Parameter isbnParam = new Parameter("userName", String.class, user, null);
soapParams.addElement(isbnParam);
soapCall.setParams(soapParams);
try {
// Invoke the remote method on the object
Response soapResponse = soapCall.invoke(url,"");
// Check to see if there is an error, return "N/A"
if (soapResponse.generatedFault()) {
Fault fault = soapResponse.getFault();
String f = fault.getFaultString();
return f;
} else {
// read result
Parameter soapResult = soapResponse.getReturnValue ();
// get a string from the result
return soapResult.getValue().toString();
}
} catch (SOAPException se) {
return se.getMessage();
}
}
}
3,使用wsdl2java把WSDL文件转成本地类,然后像本地类一样使用,即可。
这是像我这种懒人最喜欢的方式,仍然以前面的global weather report为例。
首先   java org.apache.axis.wsdl.WSDL2Java http://www.webservicex.net/globalweather.asmx.WSDL
原本的网址是http://www.webservicex.net/globalweather.asmx?WSDL,中间个各问号,但是Linux下面它不能解析,所以去掉问号,改为点号。
那么就会出现4个文件:
GlobalWeather.java  GlobalWeatherLocator.java  GlobalWeatherSoap.java  GlobalWeatherSoapStub.java
其中GlobalWeatherSoap.java是我们最为关心的接口文件,如果你对RMI等SOAP实现的具体细节不感兴趣,那么你只需要看接口文件即可,在使用的时候,引入这个接口即可,就好像使用本地类一样。
