搭建AXIS2 webservice
来源:互联网 发布:comfortable zone 知乎 编辑:程序博客网 时间:2024/04/27 19:45
1. download following archives:
2. unzip the last two zips to below directory for installing eclipse plug-in:
3. if plug-in installed success, you will see following effect:
4. unzip axis2.war from axis-1.6.2-war.zip to /tomcat/webapps/, start tomcat, inputhttp://localhost:8080/axis2. you will see:
5. then, write a webservice example by yourself, code as belows:
public class HelloService {
public String sayHello(String name)
{
return name + "say : hello [axis2]";
}
}
put the class file of this to /tomcat/webapps/pojo/, if there is no pojo forder, please create one.
the you will find your service with: http://localhost:8080/axis2/services/listServices/
6. The reason we put class into pojo is there is code as below under /tomcat/webapps/axis2/WEB-INF/conf/axis2.xml:
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
7. try address: localhost:8080/axis2/services/HelloService/sayHello?name=jason, it will return a message as below:
<ns:sayHelloResponse><return>jasonsay : hello [axis2]</return></ns:sayHelloResponse>
8. client-side test code is:
package client;
import javax.xml.namespace.QName;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class TestClient {
public static void main(String[] args) {
try{
RPCServiceClient client=new RPCServiceClient();
Options options = client.getOptions();
String address = "http://localhost:8080/axis2/services/HelloService";
EndpointReference epf = new EndpointReference(address);
options.setTo(epf);
QName qname = new QName("http://ws.apache.org/axis2", "sayHello");
Object[] result = client.invokeBlocking(qname, new Object[]{"jake"}, new Class[]{String.class});
System.out.println(result[0]);
}catch (Exception e) {
e.printStackTrace();
}
}
}
over!
2. unzip the last two zips to below directory for installing eclipse plug-in:
3. if plug-in installed success, you will see following effect:
4. unzip axis2.war from axis-1.6.2-war.zip to /tomcat/webapps/, start tomcat, inputhttp://localhost:8080/axis2. you will see:
5. then, write a webservice example by yourself, code as belows:
public class HelloService {
public String sayHello(String name)
{
return name + "say : hello [axis2]";
}
}
put the class file of this to /tomcat/webapps/pojo/, if there is no pojo forder, please create one.
the you will find your service with: http://localhost:8080/axis2/services/listServices/
6. The reason we put class into pojo is there is code as below under /tomcat/webapps/axis2/WEB-INF/conf/axis2.xml:
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
7. try address: localhost:8080/axis2/services/HelloService/sayHello?name=jason, it will return a message as below:
<ns:sayHelloResponse><return>jasonsay : hello [axis2]</return></ns:sayHelloResponse>
8. client-side test code is:
package client;
import javax.xml.namespace.QName;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class TestClient {
public static void main(String[] args) {
try{
RPCServiceClient client=new RPCServiceClient();
Options options = client.getOptions();
String address = "http://localhost:8080/axis2/services/HelloService";
EndpointReference epf = new EndpointReference(address);
options.setTo(epf);
QName qname = new QName("http://ws.apache.org/axis2", "sayHello");
Object[] result = client.invokeBlocking(qname, new Object[]{"jake"}, new Class[]{String.class});
System.out.println(result[0]);
}catch (Exception e) {
e.printStackTrace();
}
}
}
over!
- Axis2+Tomcat 搭建WebService
- 搭建AXIS2 webservice
- Java Axis2搭建WebService
- axis2 webService服务搭建
- WebService-----Axis2搭建WebService项目
- 搭建简单的webservice服务端 -- axis2
- 使用Axis2搭建WebService环境(一)
- Java EE+axis2搭建webservice服务(一)
- Java EE+axis2搭建webservice服务(二)
- Axis2 WebService
- WebService axis2
- webservice:Axis2
- axis2 webservice
- axis2 webservice
- axis2 webservice
- webservice:Axis2
- axis2 webservice
- Axis2 WebService
- [Feature phone系列]手机芯片结构介绍
- android videoview,旋转 视频 orientation,rotation 等
- extjs4 【charts】 查阅 属性
- 软件项目管理流程总结
- android power key 长按8s 关机
- 搭建AXIS2 webservice
- 红薯 初学 Java Web 开发,请远离各种框架,从 Servlet 开发
- Cygwin中文乱码 vim语法高亮 ls颜色显示
- 该做一些总结了
- Flex常用组件
- CSS制作水平垂直居中对齐
- jboss 基本配置(端口、编码、访问、log)
- Android的Window类 [转]
- 如何控制触发器递归