2013-02-21 33 views
0

我已經搜索論壇對此的答案。我發現了一個幾乎相同的問題,儘管答案讓我仍然想知道。定時Mule Web服務客戶端流程

幾乎相同的職位是在這裏找到:

Mule - Schedule a flow to consume a web service

這張海報說我有很好的問題。

我也是新來的騾,我正在嘗試做同樣的事情。我沒有意識到我需要一個有效載荷,因爲我認爲操作規範本質上是有效載荷。

請注意,我有一個包含cxf:jaxws-client的流程,並且該客戶端指定了該服務的URL以及「listTest」操作。

爲了真正執行服務請求,我需要指定哪些其他有效負載?

我試圖添加一個虛擬負載到事件發生器(如參考文章中所建議的),並沒有什麼區別。

當我執行mule應用程序,並監視「測試審計員web服務」(使用wireshark)我看到四個請求出去的wsdl,我看到wsdl返回,但我實際上看不到listTest操作獲取調用。

我的流程是:

<http:connector name="HTTP_HTTPS" cookieSpec="netscape" 
    validateConnections="true" sendBufferSize="0" receiveBufferSize="0" 
    receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" 
    socketSoLinger="0" doc:name="HTTP\HTTPS" /> 
    <flow name="TestAuditorClient_CheckerFlow1" doc:name="TestAuditorClient_CheckerFlow1"> 
    <quartz:outbound-endpoint jobName="GetTestList" 
     repeatInterval="10000" responseTimeout="10000" doc:name="Quartz"> 
     <quartz:event-generator-job jobGroupName="GetTestList" /> 
    </quartz:outbound-endpoint> 
    <cxf:jaxws-client operation="listTest" 
     clientClass="server.TestService_Service" port="TestServicePort" 
     wsdlLocation="http://192.168.66.7:8080/TestAuditorWebApp/TestService?wsdl" 
     doc:name="SOAPY" /> 
    <outbound-endpoint 
     address="http://192.168.66.7:8080/TestAuditorWebApp/TestService" 
     doc:name="HTTP" /> 
    <logger message="Received HTTP Response #[payload]" level="INFO" 
     doc:name="Logger" /> 
    <!-- <outbound-endpoint exchange-pattern="request-response" address="http://192.168.66.17:8080/TestAuditorWebApp/TestService" 
     doc:name="HTTP"/> --> 
    <file:outbound-endpoint path="C:\tmp" 
     outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].txt" 
     responseTimeout="10000" doc:name="Output File" /> 
</flow> 

我不僅新騾,但還有堆棧溢出。因此,如果有更好的方式提出相關問題,請提供建議和理由。

在此先感謝。

+0

'server.TestService_Service'上的'listTest'方法需要什麼對象參數? – 2013-02-21 17:11:01

+0

public class TestService_Service extends Service – 2013-02-21 18:26:28

+0

@WebResult(name =「listTestResponse」,targetNamespace =「http:// server /」,partName =「parameters」) @Action(input =「http:// server/TestService/listTestRequest」 ,輸出= 「HTTP://服務器/ TestService的/ listTestResponse」) @WebMethod 公共ListTestResponse listTest( @WebParam(零件名稱= 「參數」,名字= 「listTest」 的targetNamespace = 「HTTP://服務器/」) ListTest parameters ); – 2013-02-21 18:27:04

回答

0

代替Quartz,您可以使用poll消息處理器來生成您需要的ListTest的實例。

假設該類FQDN是server.TestService.ListTest(你沒有告訴),下面應該工作:

<flow name="TestAuditorClient_CheckerFlow1"> 
    <poll frequency="10000"> 
    <set-payload value="#[lt=new server.TestService.ListTest(); lt.aField='aValue'; lt]" /> 
    </poll> 
... 

注意如何能上POJO直接從創建它的表達設定值。

+0

謝謝我正在嘗試您的建議: 執行表達式「lt = new server.TestService.ListTest(); lt.aField ='aValue'; 「失敗。 (org.mule.api.expression.ExpressionRuntimeException)。消息有效負載的類型爲:字符串 – 2013-02-21 19:32:08

+0

嗯,這是*示例*。你沒有指定ListTest支持的字段。您沒有指定其FQDN。因此,您必須調整表達式以使其與您的實際代碼一起工作。 – 2013-02-21 19:34:38

+0

耶。這工作: \t \t <輪詢頻率= 「10000」> \t \t \t <設定有效載荷 \t \t \t \t值= 「#[LT =新server.ListTest(); LT]」/> \t \t – 2013-02-21 19:45:42