Camel转发WebService请求

编程技术  /  houtizong 发布于 3年前   72

Camel转发WebService请求方法一:

 前端为CXF,OSGI-INF/blueprint/blueprint.xml

<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"xsi:schemaLocation="        http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.1/blueprint.xsd"><camelcxf:cxfEndpoint id="greetingService"address="http://localhost:9080/greeting" endpointName="s:GreetingSoap"serviceName="s:GreetingService" wsdlURL="wsdl/greeting.wsdl"xmlns:s="http://demo.ceunfish.org/greeting" /><camelContext xmlns="http://camel.apache.org/schema/blueprint"><endpoint id="realWebService"uri="http://192.168.4.100:8080/greeting?throwExceptionOnFailure=false&amp;bridgeEndpoint=true" /><route id="GreetingServiceRoute"><from uri="cxf:bean:greetingService?dataFormat=MESSAGE" /><convertBodyTo type="String" /><to uri="log:input?showHeaders=true" /><to ref="realWebService" /><convertBodyTo type="String" /><to uri="log:output?showHeaders=true" /></route></camelContext></blueprint>

 方法二:

前端为jetty,OSGI-INF/blueprint/blueprint.xml

<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"xsi:schemaLocation="        http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.1/blueprint.xsd"><camelContext xmlns="http://camel.apache.org/schema/blueprint"><endpoint id="realWebService"uri="http://192.168.4.100:8080/greeting?throwExceptionOnFailure=false&amp;bridgeEndpoint=true" /><route id="GreetingServiceRoute"><from uri="jetty:http://localhost:8989/greeting" /><convertBodyTo type="String" /><to uri="log:input?showHeaders=true" /><to ref="realWebService" /><convertBodyTo type="String" /><to uri="log:output?showHeaders=true" /></route></camelContext></blueprint>

 

区别:利用CXF作前端,?wsdl展示的WSDL为指定的wsdl,但是当SOAPAction为空时请求头会缺少SOAPAction项,这样对于AXIS开发的webservice会报no soapAction header错误;

利用jetty作前端,?wsdl展示的为目标服务的wsdl,SOAPAction为空时请求头也不会丢失SOAPAction项

上一篇:Java栈与堆

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

留言需要登陆哦

技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成

网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];

      订阅博客周刊 去订阅

文章归档

文章标签

友情链接

Auther ·HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群 也可以扫右边的二维码
侯体宗的博客