solo_882 发表于 2015-8-5 10:49:21

【Web Service】Apache Tuscany发布SOAP

  Apache Tuscany
  地址:http://tuscany.apache.org
  
  准备工作:
  >下载SCA-Java-2.0包
  地址:http://tuscany.apache.org/sca-java-2x-releases.html
  选择相应系统下Binary类型的包,解压缩
  >添加jar包
  添加tuscany/lib目录下,以下3个jar包:

  tuscany-base-runtime-aggregation-2.0.jar
  tuscany-binding-ws-runtime-axis2-aggregation-2.0.jar
  tuscany-sca-api-2.0.jar
  
  1、编辑web.xml文件
  添加URL过滤





SOAPServer

tuscany
org.apache.tuscany.sca.host.webapp.TuscanyServletFilter


tuscany
/*


  
  2、新建Service接口文件
  标记interface @Remotable
  定义服务开放的方法



package com.example.service;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface IHelloWorldService {
public String say(String from);
}
  
  3、新建Service接口实现类



package com.example.service.impl;
import com.example.service.IHelloWorldService;
public class HelloWorldServiceImpl implements IHelloWorldService {
@Override
public String say(String from) {
return "Hello, " + from;
}
}
  
  4、新建.composite配置文件
  定义组件()helloworld,实现类()为“com.example.service.impl.HelloWorldServiceImpl”
  定义服务(),名为“IHelloWorldService”,绑定web service()












  
  测试:
  http://localhost:8080/HelloWorldServer/helloworld/IHelloWorldService?wsdl
  
页: [1]
查看完整版本: 【Web Service】Apache Tuscany发布SOAP