servicemix 7安装使用及camel-cxf代理webservice

阅读更多
前述:之前用servicemix3通过jbi代理webservice。由于smx版本升级较快,smx7已经弃用了jbi,转而通过camel转换协议。

servicemix 3安装及cxf-bc组件代理webservice服务
http://newjava-sina-cn.iteye.com/blog/2357092

这边文章主要是学习通过camel代理ws的学习过程。


1.安装使用servicemix7

2.camel-cxf代理webservice

3.常用命令





1.安装使用servicemix7
下载servicemix:
http://servicemix.apache.org/downloads/servicemix-7.0.0.M2.html

解压到某个路径下,如:D:\service\apache-servicemix-7.0.0.M2

配置系统变量 SERVICEMIX_HOME=D:\service\apache-servicemix-7.0.0.M2

进入bin目录下,运行servicemix.bat便可启动servicemix

servicemix 7安装使用及camel-cxf代理webservice_第1张图片

通过console shell,可以查看特性或控制servicemix,如:
bundle:list                    显示已安装的组件
bundle:list | grep camel       查找特定组件
log:display                    查看日志
log:display | grep DEBUG       查找debug日志
log:set INFO                   设置日志级别
feature:list                   查看特性(包括已安装和未安装)
feature:list | grep camel      查看感兴趣的特性

feature:install webconsole     安装web控制台

安装成功后,访问http://localhost:8181/system/console smx/smx。通过web页面,可以启动或停止组件,安装原有feature等。

由于安装一些组件可能要从maven库下载依赖的jar包,网速较慢。可以将maven库改成国内的(etc/org.ops4j.pax.url.mvn.cfg for the org.ops4j.pax.url.mvn.repositories)

servicemix 7安装使用及camel-cxf代理webservice_第2张图片




2.camel-cxf代理webservice
在eclipse新建一个普通的maven project项目(根据maven-archetype-quickstart原型)

在src/main/resources源文件下新建META-INF/spring/camel-config.xml(smx7能够识别的结构)。

配置camel-config.xml


 
  
  
 
  
  
 
    
    
 
    
      
       
      
          FooSync
      
      
      
      
      
      
      
      
      
      
      
      
      
    
 
  
 


注意事项:
a.该配置是根据camel官方实例(http://camel.apache.org/cxf-proxy-example.html)改造而来(见附件camel-example-cxf-proxy-2.11.1-sources.jar.7z),根据自己服务器地址设置callRealWebService的endpoint.uri

b.配置cxf:cxfendpoint端点时,xmlns:s应为自己的webservice的命令空间,wsdlUrl文件中的targetNamespace="http://ws.bill.com"。serviceName为服务的服务名,endpointName为服务的端口名

c.对于axis的ws,如果请求头部没有soapAction,则会报no soapAction header类似错误,cxf的ws不会有这个问题,可以去掉这个配置

d.读者可查询相关资料,调试route中的相关组件


配置完成后,右键项目run as - maven install 生成组件,在target文件夹下生成一个jar包,放到smx7的deploy文件夹下,自动部署完成

日志data/log/servicemix.log

访问http://localhost:8186/camel_0319_cxf/camel/CXF_HELLO_ObjectSpringService/IHello?wsdl
或通过soap-ui测试



改造实例源码,附件处可下载



3.常用命令
log:display   显示日志

feature:install camel-http





参考网站:
http://camel.apache.org/cxf-proxy-example.html

https://access.redhat.com/documentation/en-US/Fuse_ESB_Enterprise/7.0/html-single/Web_Services_and_Routing_with_Camel_CXF/index.html#Proxying-HTTP

  • servicemix 7安装使用及camel-cxf代理webservice_第3张图片
  • 大小: 47.8 KB
  • servicemix 7安装使用及camel-cxf代理webservice_第4张图片
  • 大小: 111.2 KB
  • camel-example-cxf-proxy-2.11.1-sources.jar.7z (18 KB)
  • 描述: 官方实例源码
  • 下载次数: 9
  • camel_0325_bundle.7z (4.2 KB)
  • 下载次数: 4
  • Fuse_ESB_Enterprise-7.0-Web_Services_and_Routing_with_Camel_CXF-en-US.pdf.7z (909.3 KB)
  • 下载次数: 3
  • 查看图片附件

你可能感兴趣的:(servicemix 7安装使用及camel-cxf代理webservice)