开发环境:
Mule Studio - Tooling for Mule ESB
Version: 3.5.0
官网上是AppMule Studio 3.5了,版本不太一样,工件已经改成了web service consumer.
服务端hello-server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" 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.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://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="helloService" doc:name="helloService">
<http:inbound-endpoint address="http://localhost:63081/hello" exchange-pattern="request-response" doc:name="HTTP">
<cxf:simple-service serviceClass="com.congxing.hello.server.IHelloWorld"/>
</http:inbound-endpoint>
<!--
<custom-transformer class="com.congxing.hello.server.HelloServerTransformer" doc:name="Java"/>
-->
<component class="com.congxing.hello.server.HelloWorldImpl" doc:name="Java"/>
</flow>
</mule>
服务端hello-client.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" 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.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://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="hello-clientFlow1" doc:name="hello-clientFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="63082" doc:name="HTTP"/>
<custom-transformer class="com.congxing.hello.client.HelloClientTransformer" doc:name="组装数据"/>
<response>
<logger level="INFO" doc:name="Logger" message="The second log::#[payload]"/>
</response>
<response>
<component class="com.congxing.hello.client.HelloClientRespDealer" doc:name="解析响应数据"/>
</response>
<response>
<logger message="The first log:#[payload]" level="INFO" doc:name="Logger"/>
</response>
<cxf:jaxws-client operation="sayHello" clientClass="com.congxing.hello.client.IHelloWorld" port="IHelloWorldPort" wsdlLocation="classpath:com/congxing/hello/client/hello.xml" doc:name="SOAP"/>
<outbound-endpoint exchange-pattern="request-response" address="http://localhost:63081/hello" doc:name="Generic"/>
<!--
<component class="com.congxing.hello.client.HelloClientRespDealer" doc:name="Java"/>
-->
</flow>
</mule>
本文介绍了一个使用Mule ESB实现的服务端与客户端交互案例,通过配置XML文件,搭建了服务端和客户端之间的请求响应流程,涉及HTTP与CXF组件的使用。

471

被折叠的 条评论
为什么被折叠?



