我開始與騾流,並已看到我見過這個頁面http://www.mulesoft.org/documentation/display/MULE3CONCEPTS/Using+Mule+with+Web+Services和http://www.mulesoft.org/documentation/display/MULEWS/Consuming+SOAP+Web+Services+in+Mule這個OE了。他們沒有太大的幫助。目前,我有一個簡單的騾子流量,如下所示。如何在Mule流中使用SOAP Web服務?
流定義
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1"
xsi:schemaLocation="
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.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
<flow name="EchoFlow" doc:name="EchoFlow">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" path="service/echoflow" doc:name="HTTP" />
<cxf:jaxws-client operation="" serviceClass="com.myapp.demo.ServiceAImplService"
doc:name="SOAP"/>
<outbound-endpoint address="http://localhost:8080/ServiceA/services/" doc:name="Generic"/>
</flow>
</mule>
我使用的騾子工作室。有一個HTTP入站端點需要響應。我嘗試配置一個將調用實際Web服務的jax-ws客戶端。該服務的WSDL是:
wsdl文件
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="ServiceAImplService" targetNamespace="http://service.demo.myapp.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://service.demo.myapp.com/" schemaLocation="http://localhost:8080/ServiceA/services/ServiceAImplPort?xsd=serviceaimpl_schema1.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="helloResponse">
<wsdl:part element="tns:helloResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="hello">
<wsdl:part element="tns:hello" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="IServiceA">
<wsdl:operation name="hello">
<wsdl:input message="tns:hello" name="hello">
</wsdl:input>
<wsdl:output message="tns:helloResponse" name="helloResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceAImplServiceSoapBinding" type="tns:IServiceA">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:Hello" style="document"/>
<wsdl:input name="hello">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="helloResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServiceAImplService">
<wsdl:port binding="tns:ServiceAImplServiceSoapBinding" name="ServiceAImplPort">
<soap:address location="http://localhost:8080/ServiceA/services/ServiceAImplPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我也不太清楚有關配置JAX-WS客戶端,你可以看到。那麼,我該如何在這個流程中使用SOAP Web服務。
我的第二個問題:我如何轉換有效負載以從一個Web服務調用另一個Web服務(都是SOAP)。流量是什麼?
最後,如何合併有效載荷?比方說,我有三個並行調用的Web服務,它們的響應都一起返回。如何合併有效載荷,以便我可以在另一個服務中讀取它(在並行調用多個服務的響應之後)?
什麼是利用CXF代理服務/客戶端的
<pattern:web-service-proxy name="ex-proxy"
inboundAddress="http://localhost:8081/xxx"
outboundAddress="http://xx.xx.com/XXX_WS/xxxWService.asmx" />
相當於實施?這就讓我想到另一個問題:何時使用CXF服務以及何時使用CXF客戶端?最後,是否有Mule Flow Orchestration的詳細文檔或示例/教程?
@Petter的回答給你提供了很好的線索。你的問題中有一點是不清楚的:你是否想要公開整體服務?作爲另一個Web服務或僅僅是一個普通的HTTP資源(如您的示例中所示)? – 2012-04-10 14:14:19
我知道這些組件。但是,我不能正確配置它們,因爲沒有適當的文檔/示例!一個簡單的CXF代理示例將對幫助我有很大的幫助。我從不去尋求代碼,但我堅持了一個星期沒有任何進展! – r3st0r3 2012-04-10 21:47:03
我看到jaxws-client的操作屬性是「」,這是不對的。您是否嘗試過使用「hello」?你會得到什麼錯誤? – 2012-04-10 21:59:00