Axis2 -POJO
POJO,Plain Old Java Object,简单Java物。
通告Webservice
1.书写Hello.java
public class Hello {
public String sayHello(){
return "hello";
}
public String sayHelloToPerson(String name){
if(name==null){
name = "nobody";
}
return "hello,"+name;
}
}
2.编译并放到工作文件夹
编译Hello.java得到Hello.class,并放到<Tomcat安装文件夹>\webapps\axis2\WEB-INF\pojo\文件夹中(假设没有pojo文件夹,则建立该文件夹)。
如今我们已经成功将Hello类公布成了WebService。
在浏览器地址栏中输入例如以下的URL:http://localhost:8080/axis2/services/listServices ,得到下图结果。
链接 wsdl" target="_self"> wsdl
http://localhost:8080/axis2/services/Hello?
本质是xml。
链接 http://localhost:8080/axis2/services/Hello?xsd 得到xsd。Xml Schema Definition。xml 模式定义,本质是xml。
使用Webservice
a ) http请求得到xml
b) javaclient使用
1. wsdl2java得到stub.java
内容见下:
import org.apache.ws.axis2.HelloStub;
import org.apache.ws.axis2.HelloStub.SayHello;
import org.apache.ws.axis2.HelloStub.SayHelloResponse;
import org.apache.ws.axis2.HelloStub.SayHelloToPerson; public class StubClient
{
public static void main(String[] args) throws Exception
{
HelloStub stub = new HelloStub();
SayHello obj=new SayHello();
SayHelloToPerson obj2=new SayHelloToPerson();
obj2.setName("XiaoMing");
SayHelloResponse response=stub.sayHello(obj);
String str=response.get_return();
System.out.println(str);
System.out.println(stub.sayHelloToPerson(obj2).get_return());
}
}
/*
hello
hello,XiaoMing
*/
它解释说,它已成功地朋友!
Axis2 -POJO的更多相关文章
- 2.1 Apache Axis2 快速学习手册之 POJO 构建Web Service
1. 准备:创建一个Maven Web App 项目 这里让我们使用Maven 模板创建一个Web App 项目 1. New------> Maven Project 2. 使用默认配置,点击 ...
- WebService之Axis2(1):用POJO实现0配置的WebService
Axis2是一套崭新的WebService引擎,该版本是对Axis1.x重新设计的产物.Axis2不仅支持SOAP1.1和SOAP1.2,还集成了非常流行的REST WebService,同时还支持S ...
- axis2开发webservice入门到精通
1,准备工作: 首先我们要下载:axis2-1.4.1-war(发布webservice),axis2-1.4.1-bin.zip(webservice调用使用的各种包). 下载好了,把axis2-1 ...
- Axis2测试webservice server以及client
一.环境搭建 下载axis2-1.6.2-war.zip/axis2-1.6.2-bin.zip等. 参考axis2-1.6.2-war\README.txt以及axis2-1.6.2-war\axi ...
- webservice的Axis2入门教程java版
本文转自百度文库 Axis2是一套崭新的WebService引擎,该版本是对Axis1.x重新设计的产物.Axis2不仅支持SOAP1.1和SOAP1.2,还集成了非常流行的REST WebServi ...
- axis2 webservice 发布、调用与项目集成
发布 1.在apache官网下载axis2包,下载Binary Distribution和War Distribution两个zip. 2.将war放入tomcat webapps下部署.并输入 ht ...
- jboss\server\default\.\tmp 拒绝访问 axis2
下载axis2.war包. 下载jboss-4.2.3.GA.zip和jboss-5.0.1.GA.zip两个包并解压. 配置JDK后要配置JBOSS_HOME的环境变量,在Path中配置%JBOSS ...
- WebService之Axis2(4):二进制文件传输
在<WebService大讲堂之Axis2(2):复合类型数据的传递>中讲过,如果要传递二进制文件(如图像.音频文件等),可以使用byte[]作为数据类型进行传递,然后客户端使用RPC方式 ...
- axis2 部署webservice
1.下载axis2-1.6.4-war.zip 2.将axis2.war防止webapps下. 3.http://localhost:8080/axis2/ 4.myeclipse创建web serv ...
随机推荐
- jQuery 自学笔记—5 遍历
什么是遍历? jQuery 遍历,意为“移动”,用于根据其相对于其他元素的关系来“查找”(或选取)HTML 元素.以某项选择开始,并沿着这个选择移动,直到抵达您期望的元素为止. 下图展示了一个家族树. ...
- Spring整合Jms学习(三)_MessageConverter介绍
1.4 消息转换器MessageConverter MessageConverter的作用主要有双方面,一方面它能够把我们的非标准化Message对象转换成我们的目标Message对象,这主要 ...
- Android Studio 入门(转)
本文适用于从Eclipse转AndroidStudio的开发者 最近打算写一个系列的android初级开发教程,预计40篇以上的文章,结合我实际工作中的经验,写一些工作中经常用到的技术,让初学者可以少 ...
- linq 中执行方法
Database1Entities db = new Database1Entities(); protected void Page_Load(object sender, EventArgs e) ...
- Android获取SIM卡信息--TelephonyManager
1>获得TelephonyManager TelephonyManager telMgr = (TelephonyManager) getSystemService(TELEPHONY_SER ...
- VMware workstation 安装错误提示1021解决方法
Failed to create the requested registry key Key: Installer Error: 1021 解决方法:删除注册表--HKEY_LOCAL_MACHIN ...
- Git双机同步
如果使用git init 初始化,当客户端仓库push内容时,服务器端仓库可以看到log,但是更新的文件不能显示,必须使用git reset --hard才能更新内容
- C++ Primer 学习笔记_44_STL实践与分析(18)--再谈迭代器【下】
STL实践与分析 --再谈迭代器[下] 三.反向迭代器[续:习题] //P355 习题11.19 int main() { vector<int> iVec; for (vector< ...
- lca转RMQ
这个博客写得好 #include <stdio.h> #include <vector> #include <string.h> using namespace s ...
- Web Worker在WebKit中的实现机制
web worker 是执行在后台的 JavaScript,独立于其它脚本.不会影响页面的性能.这是HTML5的一个标准:实现上讲.浏览器为wokrer启动了新的线程,从而实现了异步操作的功能; 以下 ...