mule2.2.x架构(四)示例学习StockQuote
所有的示例文档
http://www.mulesoft.org/display/MULE2INTRO/Examples
本示例参考地址
http://www.mulesoft.org/display/MULE2INTRO/Stock+Quote+Example
3 简单示例StockQuote
3.1 标准IO输入,输出到VM
配置文件stdio-config.xml
<!-- 配置文件中载入提示欢迎信息 -->
<stdio:connector name="SystemStreamConnector"
promptMessageCode="2"
resourceBundle="stockquote.messages.stockquote-messages"
messageDelayTime="1000"/>
<model name="Sample">
<service name="Console I/O">
<inbound>
<!-- 标注IO输入 -->
<stdio:inbound-endpoint system="IN" synchronous="true"/>
</inbound>
<outbound>
<chaining-router>
<!-- 链式输出:输出到VM内部queen -->
<vm:outbound-endpoint path="stockquote"/>
<!-- 链式输出:标准系统输出 -->
<stdio:outbound-endpoint system="OUT"/>
</chaining-router>
</outbound>
</service>
</model>
单独启动这个配置文件,要报错,因为找不到对应的VM stockquote,这个配置文件要和后面的文件配合启动,命令行启动的话:
"%MULE_BASE%\bin\mule.bat" -config "stdio-config.xml,stockquote-rest-config.xml"
"%MULE_BASE%\bin\mule.bat" -config "stdio-config.xml,stockquote-wsdl-config.xml"
"%MULE_BASE%\bin\mule.bat" -config "stdio-config.xml,stockquote-soap-config.xml"
eclipse启动的话,要用Run Configuration---->Configuration Files-----Add
添加多个xml配置文件,然后再Run就OK了。
3.2 输出到REST的服务器
配置文件stockquote-rest-config.xml
<!-- 读取配置文件proxy.properties,配置访问外网的HTTP代理 -->
<context:property-placeholder location="stockquote/proxy.properties"/>
<http:connector name="HttpConnector"
proxyHostname="${proxyHostname}"
proxyPassword="${proxyPassword}"
proxyPort="${proxyPort}"
proxyUsername="${proxyUsername}"/>
<xm:xml-to-object-transformer name="XmlToObject"/>
<xml-entity-decoder-transformer name="XmlDecoder"/>
<xm:xslt-transformer name="Xslt" xsl-file="stockquote/xsl/rest-stock.xsl"/>
<object-to-string-transformer name="ToString"/>
<model name="Sample-Rest">
<service name="HTTPPostSample">
<inbound>
<!-- 结合上面的stdio-config.xml输出的stockquote,这里接收信息 -->
<vm:inbound-endpoint path="stockquote"
responseTransformer-refs="ToString XmlDecoder Xslt XmlToObject" synchronous="true"/>
</inbound>
<http:rest-service-component
serviceUrl="http://www.webservicex.net/stockquote.asmx/GetQuote"
httpMethod="POST">
<http:payloadParameterName value="symbol"/>
</http:rest-service-component>
</service>
</model>
最后的发送向一个REST服务,这个服务是外网的:
http://www.webservicex.net/stockquote.asmx/GetQuote
3.3 发送到SOAP服务的WS上
配置文件stockquote-soap-config.xml,和上面的rest的核心区别就在于最后的发送配置
<outbound>
<pass-through-router>
<axis:outbound-endpoint
address="http://www.webservicex.net/stockquote.asmx?method=GetQuote"
soapAction="#[methodNamespace]#[method]">
<axis:soap-method method="qname{GetQuote:http://www.webserviceX.NET/}">
<axis:soap-parameter parameter="symbol" type="string" mode="IN"/>
<axis:soap-parameter parameter="GetQuoteResult" type="string" mode="OUT"/>
</axis:soap-method>
</axis:outbound-endpoint>
</pass-through-router>
</outbound>
3.4 发送到wsdl
配置文件stockquote-wsdl-config.xml,和前面的核心区别如下
<outbound>
<pass-through-router>
<outbound-endpoint
address="wsdl-cxf:http://www.webservicex.net/stockquote.asmx? WSDL&method=GetQuote" />
</pass-through-router>
</outbound>
但是3.1+3.2;3.1+3.2我都测试成功了,就是3.1+3.3测试失败。但是明白了这个示例的意思,以后可以自己启动一些WS的服务来详细测试。
分享到:
相关推荐
自己翻译的Mule 2.x Getting Started Guide的文档,里边很多翻译的不是很好,各位需要的可以下载看一下,内容大多是对Mule进行简单的介绍!
ESB解决方案-mule分享.docxESB解决方案-mule分享.docxESB解决方案-mule分享.docxESB解决方案-mule分享.docxESB解决方案-mule分享.docxESB解决方案-mule分享.docxESB解决方案-mule分享.docxESB解决方案-mule分享.docx
GomPlayer类似于KMplayer,同样也是一款来自韩国播放器,界面精美、功能全面。多媒体播放器GOMPlayer... 以‘查找解码’功能来支持所有视频的播放,在BT或e-mule等P2P网站中下载的影片会经常不能播放,GOM Player以独
Mule讲解.docxMule讲解.docx
2) 支持BT或e-mule等P2P站点中接收到损坏的文件, 因中断页传送完成的文件, 索引损坏的AVI文件的播放. 3) 想截取的视频画面可以储存为图像 (JPG, BMP)文件, 还可以通过连续截图取功能来实现把影片的场景以帧为单位, ...
NULL 博文链接:https://lonely.iteye.com/blog/601103
包含http、cxf、vm、sap、activeMq、ftp、file、poll、Smtp、attachment、melExpression、Java、template节点的使用示例等。
弹性APM Mule3代理介绍此插件允许使用Elastic APM监视Mule 3.x组件的应用程序性能。 它提供了一种非侵入性的方式来度量和基准化Mule中的各个流程和步骤,并添加了对Mule组件的应用程序性能监控,以与日志,指标和...
MULE与ServiceMix的区别的各种摘要
Manning.Mule.in.Action.2nd.Edition.Feb.2014.pdf 第二版 及 源码
Mule2编译指南 博文链接:https://netfly.iteye.com/blog/222123
EIP经典案例Load Broker————Mule ESB实践
The book closes with a set of chapterson the nuts and bolts of working with Mule. Readers can take Mule farther bylearning techniques for testing, performance tuning, BPM orchestration, andeven a ...
mule 是java 实现ESB 的开源工程, 让你实现牛X的企业总线, 第2版的事mule in action....
。
David Dossot is a software architect and has created numerous modules and transports for Mule. John D’Emic is a principal solutions architect and Victor Romero a solutions architect, both at MuleSoft...
浅谈Mule ESB架构设计.doc