一、mule 例子之 helloworld
2016-03-15 15:17 老码农与海 阅读(1081) 评论(0) 收藏 举报内容:
通过浏览器访问页面,后台返回helloworld。
步骤:
1. 新建mule项目。
2. 拖http控件。
2.1 并点击控件添加connector configuration,默认配置就行。
2.2 path设为helloworld,为空也行。
3.拖payload控件。
3.1 在payload的setting 里,把value写成helloworld。
4. 运行项目。
5. 在浏览器里访问http://127.0.0.1/helloworld,页面返回helloworld。
完整的xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<mule 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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="g-helloworldFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="helloworld" doc:name="HTTP"/>
<set-payload value="helloworld" doc:name="Set Payload"/>
</flow>
</mule>
浙公网安备 33010602011771号