Axis1.4之即时发布服务
下载axis1.4开发包,解压开发包,将webapps目录下的axis文件夹拷贝到tomcat的webapps目录下。启动tomcat,在浏览器输入http://localhost:8080/axis得到如下页面:
使用axis的发布服务平台,创建和发布WebService服务有两种方式:即时发布和定制发布。即时发布服务很少用,但是为了知识体系的完整性,这里还是讲一下。本篇文章只讲即时发布服务。
写一个没有包的Java类HelloWS.java:
public class HelloWS
{
public String test(String a,String b){
String result = "a="+a+" b="+b;
return "server response ok ,u send "+result;
}
}
然后将此文件拷贝到tomcat_home\webapps\axis目录下,并将文件后缀改为jws。在浏览器输入http://localhost:8080/axis/HelloWS.jws得到如下页面:
点击链接,浏览器展现一个wsdl文档:
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/HelloWS.jws" xmlns:intf="http://localhost:8080/axis/HelloWS.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost:8080/axis/HelloWS.jws">
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
<wsdl:message name="testResponse">
<wsdl:part name="testReturn" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="testRequest">
<wsdl:part name="a" type="xsd:string"/>
<wsdl:part name="b" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="HelloWS">
<wsdl:operation name="test" parameterOrder="a b">
<wsdl:input message="impl:testRequest" name="testRequest"/>
<wsdl:output message="impl:testResponse" name="testResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWSSoapBinding" type="impl:HelloWS">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="test">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="testRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>
</wsdl:input>
<wsdl:output name="testResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/HelloWS.jws" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWSService">
<wsdl:port binding="impl:HelloWSSoapBinding" name="HelloWS">
<wsdlsoap:address location="http://localhost:8080/axis/HelloWS.jws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
这就已经发布了服务。下面我们测试一下:我们新建一个Java工程,导入axis1.4开发包下的所有jar,然后写一个测试类Client:
package com.client; import java.rmi.RemoteException; import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException; import org.apache.axis.client.Call;
import org.apache.axis.client.Service; public class Client { public static void main(String[] args) throws ServiceException, RemoteException { String url = "http://localhost:8080/axis/HelloWS.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName(new QName(url,"test"));
String result = (String) call.invoke(new Object[]{"Tomcat","Jetty"});
System.out.println(result);
} }
运行,控制台输出:
这就是即时发布。即时发布在实际应用中几乎不用。下篇文章我们讨论如何利用Apache提供的axis服务平台发布定制服务。
Axis1.4之即时发布服务的更多相关文章
- Axis1.4之定制发布服务
将axis1.4_home\webapps目录下的axis文件夹拷贝到tomcat_home\webapps目录下.然后在tomcat_home\webapps\axis\WEB-INF\lib下添加 ...
- “一切都是消息”--iMSF(即时消息服务框架)之【发布-订阅】模式
MSF的名字是 Message Service Framework 的简称,由于目前框架主要功能在于处理即时(immediately)消息,所以iMSF就是 immediately Message S ...
- Webservice学习之——即时发布与定制发布
一.工具 myEclipse tomcat 6.0 以上版本 axis-bin-1_4.zip 二.即时发布 1.解压 axis-bin-1_4.zip 2.axis-bin-1_4.zip\axi ...
- “一切都是消息”--iMSF(即时消息服务框架)入门简介
“一切都是消息”--这是iMSF(即时消息服务框架)的设计哲学. MSF的名字是 Message Service Framework 的简称,由于目前框架主要功能在于处理即时(immediately) ...
- “一切都是消息”--iMSF(即时消息服务框架)之【请求-响应】模式(点对点)
MSF的名字是 Message Service Framework 的简称,由于目前框架主要功能在于处理即时(immediately)消息,所以iMSF就是 immediately Message S ...
- ServiceStack.Redis订阅发布服务的调用(Z)
1.Redis订阅发布介绍Redis订阅发布是一种消息通信模式:发布者(publisher)发送消息,订阅者(Subscriber)接受消息.类似于设计模式中的观察者模式.发布者和订阅者之间使用频 ...
- ArcGIS Server开发教程系列(2)配置ARCMAP和ARCCatalog发布服务
1. Arc catalog的配置 打开catalog,如图新增刚刚创建的server 1. Use GIS services: 用户身份连接 使用此种连接,可以浏览.使用站点内发布的所有 ...
- ServiceStack.Redis订阅发布服务的调用
1.Redis订阅发布介绍 Redis订阅发布是一种消息通信模式:发布者(publisher)发送消息,订阅者(Subscriber)接受消息.类似于设计模式中的观察者模式. 发布者和订阅者之间使用频 ...
- ArcGIS发布服务时缓存切片设置
[文件]>[共享]>[服务]>[覆盖原有服务]或[创建新服务] 设置好相关参数后,会弹出"服务编辑框": 进入"缓存" 1."绘制此 ...
随机推荐
- Redis Cluster的搭建与部署,实现redis的分布式方案
前言 上篇Redis Sentinel安装与部署,实现redis的高可用实现了redis的高可用,针对的主要是master宕机的情况,我们发现所有节点的数据都是一样的,那么一旦数据量过大,redi也会 ...
- Centos 6.5升级openssh漏洞
CentOS 6.5下openssh升级 在有的企业中每年都会安全扫描,因为实现远程连接比较重要,如果openssh版本过低,就要对其升级,本文主要讲述openssh升级的步骤. openssh升级主 ...
- windows下python3.4安装lxml提示"Unable to find vcvarsall.bat"
"https://pypi.python.org/pypi/lxml/3.6.0"从这个网址直接下载对应的lxml包,exe格式的,直接安装,问题解决!
- Extjs 4.0 Tab页
1.JSON代码 Ext.MyTabs=Ext.extend(Ext.TabPanel ,{ xtype:"tabpanel", activeTab:2, width:694, h ...
- JAVA之编码---->CSV在文本下是正常的,用EXCEL打开是乱码的问题
JAVA之编码---->CSV在文本下是正常的,用EXCEL打开是乱码的问题 在JAVA下输出文件流,保存成CSV(用UTF-8)文件,怎么处理用EXCEL下是乱码,但是在记事本等其他软件都是正 ...
- Android之PendingIntent的深入理解
PendingIntent字面意义:等待的,未决定的Intent.要得到一个pendingIntent对象,使用方法类的静态方法 getActivity(Context, int, Intent, i ...
- Linux显示列出块设备
Linux显示列出块设备 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOI ...
- vue全局配置----小白基础篇
今天学习vue全局配置.希望帮助我们去了解vue的全局配置,快速开发. Vue.config是vue的全局配置对象.包含Vue的所有全局属性: silent:boolean(默认值:false)--- ...
- cookie的设置和获取
// 创建cookiefunction setCookie(name, value, expires, path, domain, secure) { var cookieText = encodeU ...
- 决策树系列(五)——CART
CART,又名分类回归树,是在ID3的基础上进行优化的决策树,学习CART记住以下几个关键点: (1)CART既能是分类树,又能是分类树: (2)当CART是分类树时,采用GINI值作为节点分裂的依据 ...