Eclipse 开发Tuscany应用
来源:互联网 发布:更新ios10app网络错误 编辑:程序博客网 时间:2024/05/22 16:57
1. new maven project.
2. copy pom.xml
3. add Library -> user Lib -> Tuscany1-6-2
4. 项目右键 -> SCA -> Add SCA Nature
5. new SCA -> SCA.composite -> test_app.composite (生成到resources中)
6. test_app.composite:
<?xml...>
<sca:composite xmlns...>
<sca:component name="DeSkuCategoryComponent">
<sca:implementation.java class="com.dragonmarts.test.impl.DeSkuCategoryService" />
<sca:service name="DeSkuCategoryService" >
<sca:interface.java interface="com.dragonmarts.test.service.DeSkuCategoryService" />
<sca:binding.sca /> <!-- java 内部调用-->
<sca:binding.ws /> <!-- wsdl, soap 服务 -->
</sca:service>
</sca:component>
</sca:composite>
右键点击空白处 -> SCA -> 生成代码
7. copy serializable_data_type_object.xml
到resources中
8. # cd src/java/main
# wsimport -extension -b ../resources/serializable_data_type_object.xml -d . http://yourhost:9763/services/InventoryDataServices?wsdl -p com.dragonmarts.test.das -s .
wsimport -extension -b ../resources/serializable_data_type_object.xml -d . http://172.16.5.83:9763/services/CetsDataService?wsdl -p com.dragonmarts.cets.das -s .
wsimport -extension -b ../resources/serializable_data_type_object.xml -d . http://172.16.5.83:9763/services/InventoryDataService?wsdl -p com.dragonmarts.inventory.das -s .
-extension: 是为了处理没有参数的函数。如果不设,那么当有两个以上时会提示:提供参数不唯一。
9. test_app.composite:
<?xml...>
<sca:composite xmlns... targetNamespace="http://dragonmarts.com">
<sca:component name="DeSkuCategoryComponent">
<sca:implementation.java class="com.dragonmarts.test.impl.DeSkuCategoryServiceImpl" />
<sca:service name="DeSkuCategoryService" >
<sca:interface.java interface="com.dragonmarts.test.service.DeSkuCategoryService" />
<sca:binding.sca /> <!-- java 内部调用-->
<sca:binding.ws /> <!-- wsdl, soap 服务 -->
</sca:service>
<sca:reference name="testDataService">
<sca:interface.java interface="com.dragonmarts.test.das.TextDataServicePortType" />
<sca:binding.ws uri="http://127.0.0.1:....wso2server...?wsdl" />
</sca:reference>
</sca:component>
</sca:composite>
10. 到 com.dragonmarts.test.impl.DeSkuCategoryServiceImpl 中增加
public class ...{
protected TextDataServicePortType textDataService;
public void setTextDataService(TextDataServicePortType textDataService){
....
}
...
}
11. create class : com.dragonmarts.test.model.Pagination
各个项目是一样的, 需要序列化
12. create class : com.dragonmarts.test.model.DeSkuCategoryResponse:
public class ... implements Searializable {
private Pagination;
private List<DeSkuCategory> deSkuCategory;
... get, set...
}
13. com.dragonmarts.test.service.DeSkuCategoryService
public interface ...{
public DeSkuCategoryResponse getDeSkuCategoryResponseBySkuIdList(
String skuIdList);
}
14. 到 com.dragonmarts.test.impl.DeSkuCategoryServiceImpl
增加 getDeSkuCategoryResponseBySkuIdList 的实现:
public class ...{
static Logger dataServiceLogger = Logger.getLogger("testDas");
static Logger appLogger = Logger.getLogger("testApp");
...
public DeSkuCategoryResponse getDeSkuCategoryBySkuIdList(String skuIdList){
DeSkuCategoryReponse deSkuCategoryReponse = new DeSkuCategoryReponse();
...
List<DeSkuCategory> deSkuCategoryList = new ArrayList<DeSkuCategory>();
try{...}catch(...){...}
Pagination pagination = new Pagination();
...
deSkuCategoryReponse.setPagination(pagination);
...
return deSkuCategoryReponse
}
}
(隐含: 将log4j.properties放在resources文件夹下)
15. 部署
webapp目录下的结构:
META-INF
MANIFEST.MF
sca-contribution.xml
WEB-INF
web.xml
# mvn tomcat:deploy
(第二次开始,就可以直接使用 重新部署: mvn tomcat:redeploy, 这样更快)
sca-contribution.xml
中的名字要与 test.composite中相关信息相同
页面可以访问: http://127.0.0.1:8080/test_app/DeSkuCategoryComponent?wsdl
16. php 中调用
17.提交das
cd /usr/local/wso2dataservices/repository/deployment/server/dataservices
cp CetsDataService.dbs /export/wso2/cets_das/
2. copy pom.xml
3. add Library -> user Lib -> Tuscany1-6-2
4. 项目右键 -> SCA -> Add SCA Nature
5. new SCA -> SCA.composite -> test_app.composite (生成到resources中)
6. test_app.composite:
<?xml...>
<sca:composite xmlns...>
<sca:component name="DeSkuCategoryComponent">
<sca:implementation.java class="com.dragonmarts.test.impl.DeSkuCategoryService" />
<sca:service name="DeSkuCategoryService" >
<sca:interface.java interface="com.dragonmarts.test.service.DeSkuCategoryService" />
<sca:binding.sca /> <!-- java 内部调用-->
<sca:binding.ws /> <!-- wsdl, soap 服务 -->
</sca:service>
</sca:component>
</sca:composite>
右键点击空白处 -> SCA -> 生成代码
7. copy serializable_data_type_object.xml
到resources中
8. # cd src/java/main
# wsimport -extension -b ../resources/serializable_data_type_object.xml -d . http://yourhost:9763/services/InventoryDataServices?wsdl -p com.dragonmarts.test.das -s .
wsimport -extension -b ../resources/serializable_data_type_object.xml -d . http://172.16.5.83:9763/services/CetsDataService?wsdl -p com.dragonmarts.cets.das -s .
wsimport -extension -b ../resources/serializable_data_type_object.xml -d . http://172.16.5.83:9763/services/InventoryDataService?wsdl -p com.dragonmarts.inventory.das -s .
-extension: 是为了处理没有参数的函数。如果不设,那么当有两个以上时会提示:提供参数不唯一。
9. test_app.composite:
<?xml...>
<sca:composite xmlns... targetNamespace="http://dragonmarts.com">
<sca:component name="DeSkuCategoryComponent">
<sca:implementation.java class="com.dragonmarts.test.impl.DeSkuCategoryServiceImpl" />
<sca:service name="DeSkuCategoryService" >
<sca:interface.java interface="com.dragonmarts.test.service.DeSkuCategoryService" />
<sca:binding.sca /> <!-- java 内部调用-->
<sca:binding.ws /> <!-- wsdl, soap 服务 -->
</sca:service>
<sca:reference name="testDataService">
<sca:interface.java interface="com.dragonmarts.test.das.TextDataServicePortType" />
<sca:binding.ws uri="http://127.0.0.1:....wso2server...?wsdl" />
</sca:reference>
</sca:component>
</sca:composite>
10. 到 com.dragonmarts.test.impl.DeSkuCategoryServiceImpl 中增加
public class ...{
protected TextDataServicePortType textDataService;
public void setTextDataService(TextDataServicePortType textDataService){
....
}
...
}
11. create class : com.dragonmarts.test.model.Pagination
各个项目是一样的, 需要序列化
12. create class : com.dragonmarts.test.model.DeSkuCategoryResponse:
public class ... implements Searializable {
private Pagination;
private List<DeSkuCategory> deSkuCategory;
... get, set...
}
13. com.dragonmarts.test.service.DeSkuCategoryService
public interface ...{
public DeSkuCategoryResponse getDeSkuCategoryResponseBySkuIdList(
String skuIdList);
}
14. 到 com.dragonmarts.test.impl.DeSkuCategoryServiceImpl
增加 getDeSkuCategoryResponseBySkuIdList 的实现:
public class ...{
static Logger dataServiceLogger = Logger.getLogger("testDas");
static Logger appLogger = Logger.getLogger("testApp");
...
public DeSkuCategoryResponse getDeSkuCategoryBySkuIdList(String skuIdList){
DeSkuCategoryReponse deSkuCategoryReponse = new DeSkuCategoryReponse();
...
List<DeSkuCategory> deSkuCategoryList = new ArrayList<DeSkuCategory>();
try{...}catch(...){...}
Pagination pagination = new Pagination();
...
deSkuCategoryReponse.setPagination(pagination);
...
return deSkuCategoryReponse
}
}
(隐含: 将log4j.properties放在resources文件夹下)
15. 部署
webapp目录下的结构:
META-INF
MANIFEST.MF
sca-contribution.xml
WEB-INF
web.xml
# mvn tomcat:deploy
(第二次开始,就可以直接使用 重新部署: mvn tomcat:redeploy, 这样更快)
sca-contribution.xml
中的名字要与 test.composite中相关信息相同
页面可以访问: http://127.0.0.1:8080/test_app/DeSkuCategoryComponent?wsdl
16. php 中调用
17.提交das
cd /usr/local/wso2dataservices/repository/deployment/server/dataservices
cp CetsDataService.dbs /export/wso2/cets_das/
- Eclipse 开发Tuscany应用
- Eclipse开发Apache Tuscany上的SCA应用
- CMS_WEB应用TUSCANY说明
- 解决Eclipse+Tuscany[ASM_6001]问题
- tuscany
- 使用Eclipse构建Tuscany实例(1)
- 使用Eclipse构建Tuscany实例(2)
- tuscany sameples和demos导入eclipse
- 使用Eclipse构建Tuscany实例(1)
- Eclipse开发Android应用
- 《SOA思想、技术与系统集成应用详解》读书笔记四-《SOA核心技术及应用》Apache Tuscany sca安装及与eclipse结合
- 使用 Eclipse SOA Tools Platform 插件和 Apache Tuscany
- Tuscany SCA以独立应用方式运行的简单例子
- 使用Eclipse开发J2EE应用
- 使用Eclipse开发J2EE应用
- 使用Eclipse开发J2EE应用
- 使用Eclipse开发J2EE应用
- 使用Eclipse开发J2EE应用
- setAnimationStyle实现的popwindow显示消失的动画效果
- 了解SQL Server触发器及触发器中的事务
- php的autoload机制的实现解析
- Android 中的BroadCastReceiver
- Dependency Injection with Autofac
- Eclipse 开发Tuscany应用
- 解决libxml2不支持中文的问题
- 用textarea接受换行符以及多换行符的处理
- vim基本命令
- 在ubuntu上关闭tomcat的自启动
- Android自定义属性时TypedArray的使用方法
- Sqlserver自关联
- [一分钟先生]倪邵峰:管理者应具备的能力与素质
- php array_multisort 排序