如何通过Axis服务部署项目

(1)首先写wsdl文件 EditShoppingCartService.wsdl和执行属性文件 EditShoppingCartService.xsd,具体写法请参考基于AXIS2实现Web Service开发.doc

(2)通过wsdl生成Java代码,执行 Wsdl2Java.class, 参数为
-ss -ssi -sd -uri  wsdl/EditShoppingCartService.wsdl, 该代码为服务端代码

(3)把生成的代码通过 Axis2 Service Archiver打成aar包,或者打成jar包,然后改名字

(4)把 EditShoppingCartService.xsd手动加入到aar的/META-INFO/下面

(5)把axis2.war发布到tomcat上面,打开tomcat,输入 http://localhost:8080/axis2/,然后上传到axis2的系统上面

(6)生成客户端代码,执行Wsdl2Java.class, 参数为
-a  -s -p demo.test.client.adb  -uri wsdl/EditShoppingCartService.wsdl

(7)编写客户端测试类(同步)
EditShoppingCartServiceStub stub = new EditShoppingCartServiceStub();
QueryShoppingCartByCustomer req = new QueryShoppingCartByCustomer();
BookListType list =new BookListType();
BookType type = new BookType();
//放值到实体对象
//……
list.setBook(types);
//req为发送实体到服务端
req.setQueryShoppingCartByCustomer(list);
QueryShoppingCartByCustomerResponse res = stub.queryShoppingCartByCustomer(req);
//res为返回对象
//这个对象为返回的实体对象
res.getQueryShoppingCartByCustomerResponse()

(8)编写客户端测试类(异步)
EditShoppingCartServiceStub stub = new EditShoppingCartServiceStub();
QueryShoppingCartByCustomer req = new QueryShoppingCartByCustomer();
BookListType list =new BookListType();
BookType type = new BookType();
//放值到实体对象
//……
list.setBook(types);
//req为发送实体到服务端
req.setQueryShoppingCartByCustomer(list);
EditShoppingCartServiceCallbackHandler callback = new EditShoppingCartServiceCallbackHandler() {
  public void receiveResultqueryShoppingCartByCustomer(
    QueryShoppingCartByCustomerResponse result) {
    System.out.println(result.getQueryShoppingCartByCustomerResponse().getResMessage());
  }
  public void receiveErrorqueryShoppingCartByCustomer(
    java.lang.Exception e) {
  }
};
stub.startqueryShoppingCartByCustomer(req, callback);
System.out.println("send Request!!");
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值