我想模擬我的mule應用程序中的Google自動完成。 我正在使用ajax入站端點來捕獲正在瀏覽器中輸入的文本(rpc調用),流程中的下一步是調用由Google公開的URL。 http://clients5.google.com/complete/search?client=ie8&q=##variable## 爲了達到同樣的效果,我使用了動態HTTP出站端點。爲了清楚起見,我最後添加了File outbound端點,以便查看HTTP端點的完整響應。Mule 3.3.0 - 發生異常動態enpoint流 - 入站Ajax --->出站Http端點 - >文件出站
<ajax:connector name="AjaxConnectorForSpelling" serverUrl="http://localhost:8081/Ajax" resourceBase="src/main/app/docroot" jsonCommented="false" doc:name="AjaxConnectorForSpelling"/>
<http:connector name="HTTP_HTTPS" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" proxyHostname="bci****" proxyPort="8080" doc:name="HTTP\HTTPS"/>
<http:endpoint exchange-pattern="request-response" method="GET" name="httpgoogle" address="http://clients5.google.com/complete/search?client=ie8&q=#[header:INVOCATION:q]" connector-ref="HTTP_HTTPS" doc:name="HTTP"/>
<flow name="GoogleAutoComplete" doc:name="GoogleAutoComplete">
<ajax:inbound-endpoint channel="/services/echo" responseTimeout="10000" connector-ref="AjaxConnectorForSpelling" doc:name="Ajax Channel"/>
<message-properties-transformer doc:name="Message Properties" scope="invocation">
<add-message-property key="q" value="#[payload.get('q')]"/>
</message-properties-transformer>
<http:outbound-endpoint ref="httpgoogle" responseTransformer-refs="xml_to_json" doc:name="HTTP"/>
<file:outbound-endpoint path="C:\Documents and Settings\I300543\Desktop\proxyfiles\xslt" responseTimeout="10000" doc:name="File"/>
</flow>
我收到來自谷歌的反應如XML和JSON到其得到轉化和文件端點能夠將其寫入文件系統。但是我的ajax連接器失敗了(如果我使Outbound HTTP端點爲靜態,但每次都會給我相同的搜索結果,所以沒有響應返回給瀏覽器)。
我得到這個異常。
Caused by: org.mule.api.MessagingException: Endpoint scheme must be compatible with the connector scheme. Connector is: "ajax", endpoint is "http://clients5.google.com/complete/search?client=ie8&q=ask" (java.lang.IllegalArgumentException). Message payload is of type: String
at org.mule.endpoint.AbstractEndpointBuilder.doBuildOutboundEndpoint(AbstractEndpointBuilder.java:254)
at org.mule.endpoint.AbstractEndpointBuilder.buildOutboundEndpoint(AbstractEndpointBuilder.java:122)
at org.mule.endpoint.DefaultEndpointFactory.getOutboundEndpoint(DefaultEndpointFactory.java:89)
at org.mule.transport.ajax.AjaxReplyToHandler.processReplyTo(AjaxReplyToHandler.java:66)
at org.mule.routing.requestreply.AbstractReplyToPropertyRequestReplyReplier.processReplyTo(AbstractReplyToPropertyRequestReplyReplier.java:69)
所以我(僅在動態端點的情況下),也有點困惑,爲什麼AJAX接口越來越HTTP協議的參考。 我剛剛開始研究Mule,所以我不確定是否正確配置了everthing。
感謝您的回覆 - 我使用騾3.3.0,所以不應該與缺陷Mule 5783!無論如何,我嘗試了上述選項,但我仍然得到與ajax連接器相同的錯誤。 – 2012-08-21 16:01:25