自从引入ESB后,系统之间不再直接依赖。我负责的这块,主要是解决Webservice的问题。使系统A不再直接依赖系统B的Webservice。

我们选择的产品是Mule ESB。所以自然要使用Mule 创建一个Webservice代理,即系统A请求到ESB,ESB请求系统B。

准备工作:
通过我的博客《Mule ESB-Basic Studio Tutorial了解Mule
ESB的基本操作。并准备开发环境。

环境:
windows 8
jdk 1.6
mule-standalone-3.5.0-M4
MuleStudio-for-win-32bit-3.5.0-201312091746

主要步骤:
1、新建一个Mule Project
2、创建一个流程

这两步非常easy,不再赘述。操作结果:

3、编辑流程
    (1)新建一个flow
            打开gxpt_test_esb_1.0.mflow,拖一个flow scope 进去。命名为HttpProxyService。

    (2)加入HTTP Endpoint
            加入HTTP Endpoint,而且右击转换为outbound endpoint,打开属性窗体,输入address。即Webservice的endpoint。如http://192.168.24.46:8080/test_server_webservice/UserManagerBean

     (3)为这个Webservice创建一个client
         
  加入一个SOAP Component到http endpoint的前面,编辑它的属性,设置operation为proxy client
     
     (4)创建一个真正的代理服务
           加入还有一个SOAP Component到proxy
client SOAP的前面,设置operation为proxy service。设置Namespace 和 Service,必须和你要代理的Webservice的wsdl相符。在WSDL Location中填上wsdl的地址,如http://192.168.24.46:8080/test_server_webservice/UserManagerBean?wsdl
也能够将该文件放在项目的目录中。如src/
    
     (5)加入一个 HTTP inbound endpoint,设置address。如http://192.168.24.12:8888/UserManager 
 

最后,完整的flow应该是以下这个样子:



<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<flow name="HttpProxyService" doc:name="HttpProxyService">
<http:inbound-endpoint exchange-pattern="request-response" address="http://192.168.24.12:8888/UserManager" doc:name="HTTP"/>
<!-- wsdlLocation="service/UserManagerBean.wsdl" 也能够使用该属性替换掉url-->
<cxf:proxy-service namespace="http://ejb.jialin.com/" service="UserManagerBean" payload="body" wsdlLocation="http://192.168.24.46:8080/test_server_webservice/UserManagerBean?wsdl" doc:name="SOAP"/>
<cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://192.168.24.46:8080/test_server_webservice/UserManagerBean" doc:name="HTTP"/>
</flow>
<flow name="gxpt_test_esb_1.0Flow1" doc:name="gxpt_test_esb_1.0Flow1"/>
</mule>
OK,接下你能够run mule server,在浏览器中输入wsdl地址。看一下结果啦。
假设输入代理地址和直接输入目标地址。显示的wsdl一样,说明配置正确。



小结:
在这篇文章中,我介绍了怎样使用mule创建一个Webservice代理,不须要使用不论什么转换器。也不须要写一行代码。全然是配置完毕的。

在兴许文章中将继续聊Mule ESB,敬请关注。


Mule ESB-3.Build a webservice proxy的更多相关文章

  1. Mule ESB学习【转-结合了网络上的一些资源】

    1.SOA标准之一:SCA架构思想 SOA在Java领域有两套标准:一个是SUN推出的JBI(没有得到BEA和IBM的承认),另外一个是:IBM和BEA等公司推出的SCA和SDO标准. JBI之关注J ...

  2. Mule ESB 介绍

    Mule ESB 介绍 博客分类: ESB ESB  1. 简介 Mule ESB是一个基于Java的轻量级企业服务总线和集成平台,允许开发人员快速便利地连接多个应用,并支持应用间的数据交换.Mule ...

  3. EnjoyingSoft之Mule ESB开发教程第二篇:Mule ESB基本概念

    目录 1. 使用Anypoint Studio开发 2. Mule ESB Application Structure - Mule ESB应用程序结构 3. Mule ESB Application ...

  4. EnjoyingSoft之Mule ESB开发教程第六篇:Data Transform - 数据转换

    目录 1. 数据转换概念 2. 数据智能感知 - DataSense 3. 简单数据转换组件 3.1 Object to JSON 3.2 JSON to XML 3.3 JSON to Object ...

  5. Mule ESB 自带例子hello初体验

    1 配置的流的效果图 2 应用配置文件hello.xml内容 <?xml version="1.0" encoding="UTF-8"?> < ...

  6. Mule ESB 安装基本配置要求

    Hardware Requirements* 2GHz, dual-core CPU, or 2 virtual CPUs in virtualized environments 2GB of RAM ...

  7. EnjoyingSoft之Mule ESB开发教程系列第五篇:控制消息的流向-数据路由

    目录 1. 使用场景 2. 基于消息头的路由 2.1 使用JSON提交订单的消息 2.2 使用XML提交订单的消息 2.3 使用Choice组件判断订单格式 3. 基于消息内容的路由 4. 其他控制流 ...

  8. EnjoyingSoft之Mule ESB开发教程第一篇:初识Mule ESB

    目录 1. Mule ESB基本介绍 2. Mule ESB社区版和企业版 3. Mule ESB常用场景 4. Mule ESB软件安装 客户端安装 服务端安装 5. 第一个Mule ESB应用- ...

  9. EnjoyingSoft之Mule ESB开发教程第三篇:Mule message structure - Mule message结构

    目录 1. 探索Mule Message结构 2. Mule Message的Payload 3. Mule Message的Property 4. Mule Message的Attachment 5 ...

随机推荐

  1. sql的padleft

    /* SELECT dbo.fn_PadLeft('8', '0', 6) */ create function fn_PadLeft(@num nvarchar(16),@paddingChar c ...

  2. JS 有趣的eval优化输入验证

    //eval就是计算字符串[可以放任何js代码]里的值 . var str1='12+3'; eval(str1); . var str2='[1,2,3]'; eval(str2[]); .eval ...

  3. OC对象的本质及分类

    Object-C的底层都是通过C/C++来实现的,所以OC中的对象也会转化成C/C++中的某一个数据结构, 我们在终端里通过指令 xcrun -sdk iphoneos clang -arch arm ...

  4. 课上练习 script

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. 【python】os.getcwd和getcwdu

    print os.getcwd(), type(os.getcwd()) print os.getcwdu(), type(os.getcwdu()) 结果如下: C:\Users\Administr ...

  6. oracle从入门到精通复习笔记

    为方便大家跟着我的笔记练习,为此提供数据库表文件给大家下载:点我下载 描述一个表用 desc employees过滤重复的部门 select distinct department_id from e ...

  7. Assembly之instruction之MOV

    MOV[.W]   Move source to destinationMOV.B Move source to destination Syntax MOV  src,dst  or       M ...

  8. String类面试坑题

    1.面试坑题F:\SHJT\JavaWorkspace\JavaSE\workspace\day13ezra\src\cn\itcast\sh\classcode\BTStringLastIndexO ...

  9. day005 流程控制 (if / for / while)

    流程控制 语法 if判断其实就是模拟人在做判断,如果做一件事情,你使用这种方式做 或者使用另一种方式做. if 条件: 代码块 ... # 代码块(同一缩进级别的代码,例如代码1.代码2和代码3是相同 ...

  10. PHP并发IO编程实践

    PHP相关扩展 Stream:PHP内核提供的socket封装 Sockets:对底层Socket API的封装 Libevent:对libevent库的封装 Event:基于Libevent更高级的 ...