mule2.2.x架构(二)示例学习echo

本文通过三个示例介绍了Mule 2.2.x的使用方法,包括简单的echo示例、基于Axis的WebService服务及基于CXF的WebService服务。通过这些示例可以了解Mule如何进行消息传递和服务调用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

mule2.2.x架构(二)示例学习echo

所有的示例文档
http://www.mulesoft.org/display/MULE2INTRO/Examples

1.简单示例echo
1.1 简单的输入和打印信息
主要分析了配置文件echo-config.xml
<stdio:connector name="SystemStreamConnector"
promptMessage="Please enter something: " messageDelayTime="1000" />
<model name="echoSample">
<service name="EchoUMO">
<!-- 系统输入 -->
<inbound>
<stdio:inbound-endpoint system="IN" />
</inbound>
<echo-component />
<!-- 系统输出 -->
<outbound>
<pass-through-router>
<stdio:outbound-endpoint system="OUT" />
</pass-through-router>
</outbound>
</service>
</model>
其中的<echo-component />是
<service name="EchoUMO">
<component class="org.mule.component.simple.EchoComponent"/>
</service>
的缩写。EchoComponent实现了日志功能。

1.2 axis的webserice服务
分析配置文件echo-axis-config.xml
<model name="echoSample">
<service name="EchoUMO">
<inbound>
<axis:inbound-endpoint address="http://localhost:65081/services">
<soap:http-to-soap-request-transformer/>
</axis:inbound-endpoint>
</inbound>
<echo-component/>
</service>
</model>
访问URL
http://localhost:65081/services/EchoUMO?method=echo&param=iamcarl
访问WSDL文件
http://localhost:65081/services/EchoUMO?wsdl

1.3 cxf的webservice服务
<service name="EchoUMO">
<inbound>
<cxf:inbound-endpoint address="http://localhost:65082/services/EchoUMO" serviceClass="com.sillycat.easymule.echo.Echo"/>
</inbound>
、 <echo-component/>
</service>
其中com.sillycat.easymule.echo.Echo是从example中拷贝出来的一个接口定义。
package com.sillycat.easymule.echo;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
@WebService
public interface Echo {
@WebResult(name = "text")
public String echo(@WebParam(name = "text") String string);
}
访问服务的参数是:
http://host/service/OPERATION/PARAM_NAME/PARAM_VALUE
http://localhost:65082/services/EchoUMO/echo/text/hello
访问WSDL文件:
http://localhost:65082/services/EchoUMO?wsdl

就是简单的把example拷贝出来了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值