mule使用SOAP工件發佈和消費web Service的簡單例子

開發環境:

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="&#32452;&#35013;&#25968;&#25454;"/>
        <response>
            <logger level="INFO" doc:name="Logger" message="The second log::#[payload]"/>
        </response>
        <response>
            <component class="com.congxing.hello.client.HelloClientRespDealer" doc:name="&#35299;&#26512;&#21709;&#24212;&#25968;&#25454;"/>
        </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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章