2013-04-23 48 views
2

我正在嘗試使用HTTPS入站端點的流程。在Mule ESB中創建HTTPS服務

到目前爲止,我能做到以下幾點:

  • 通過終端使用此命令創建密鑰庫文件:

    keytool -genkey -alias mule -keyalg RSA -keystore keystore.jks

  • 放在keystore.jks在我的騾子應用SRC/main/resources目錄

  • 使用以下設置創建全局HTTPS連接器:

enter image description here

  • 在我的HTTP入站端點檢查「啓用HTTPS」複選框,並選擇我的新的全球HTTPS連接器連接器參考。

我的問題是當訪問所述端點,可以說 https://localhost:8082/getProducts

瀏覽器將引發此消息

SSL connection error 
Unable to make a secure connection to the server. This may be a problem with the server,  or it may be requiring a client authentication certificate that you don't have. 
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error. 

而在我的騾子登錄我有以下幾點:

ERROR 2013-04-23 12:08:55,451 [[integrador-catalogogit].connector.http.mule.default.receiver.02] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: Http Request line is malformed: "�?��?Qv??e]?.�t#?G??*?p?V*????stS��H?" 
org.apache.commons.httpclient.ProtocolException: Http Request line is malformed: "�?��?Qv??e]?.�t#?G??*?p?V*????stS��H?" 
at org.mule.transport.http.RequestLine.parseLine(RequestLine.java:52) 
at org.mule.transport.http.HttpServerConnection.readRequest(HttpServerConnection.java:190) 
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:155) 
at org.mule.work.WorkerContext.run(WorkerContext.java:311) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 
at java.lang.Thread.run(Thread.java:680) 
ERROR 2013-04-23 12:08:55,467 [[integrador-catalogogit].connector.http.mule.default.receiver.03] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: Http Request line is malformed: "�?��?Qv???P?*?~c?q?6?]??W?[??��H?" 
org.apache.commons.httpclient.ProtocolException: Http Request line is malformed: "�?��?Qv???P?*?~c?q?6?]??W?[??��H?" 
at org.mule.transport.http.RequestLine.parseLine(RequestLine.java:52) 
at org.mule.transport.http.HttpServerConnection.readRequest(HttpServerConnection.java:190) 
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:155) 
at org.mule.work.WorkerContext.run(WorkerContext.java:311) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 
at java.lang.Thread.run(Thread.java:680) 
ERROR 2013-04-23 12:08:55,469 [[integrador-catalogogit].connector.http.mule.default.receiver.03] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: Http Request line is malformed: "��U��Q�Qv?cN????;]<???-???^S???G[?��*�?�?�?�9�8�?�5�E�D�f�3�2�?�A���/��??�" 
org.apache.commons.httpclient.ProtocolException: Http Request line is malformed: "��U��Q�Qv?cN????;]<???-???^S???G[?��*�?�?�?�9�8�?�5�E�D�f�3�2�?�A���/��??�" 
at org.mule.transport.http.RequestLine.parseLine(RequestLine.java:52) 
at org.mule.transport.http.HttpServerConnection.readRequest(HttpServerConnection.java:190) 
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:155) 
at org.mule.work.WorkerContext.run(WorkerContext.java:311) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) 
at java.lang.Thread.run(Thread.java:680) 

可能我缺少服務器端或騾方的配置步驟。

我真的很感謝你的幫助。

編輯

我的XML最終看起來像this

<?xml version="1.0" encoding="UTF-8"?> 
<mule xmlns:https="http://www.mulesoft.org/schema/mule/https" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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.3.1" xsi:schemaLocation=" 
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.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/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd 
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 "> 
    <https:connector name="HTTP_HTTPS" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" proxyHostname="localhost" proxyPort="80" doc:name="HTTP\HTTPS"> 
     <https:tls-client path="keystore.jks" storePassword="1234"/> 
     <https:tls-key-store path="keystore.jks" keyPassword="1234" storePassword="1234"/> 
     <https:tls-server path="keystore.jks" storePassword="1234"/> 
    </https:connector> 
    <flow name="getProducts" doc:name="getProducts"> 
     <https:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="getProducts" doc:name="HTTP" connector-ref="HTTP_HTTPS"/> 
     <json:json-to-object-transformer returnClass="Codefuel.parameters.RequestParameters" doc:name="JSON to Object"/> 
     <component class="Codefuel.product.mulesoft.GetProductByParameters" doc:name="GetProductByParameters"/> 
     <json:object-to-json-transformer doc:name="Object to JSON"/> 
    </flow> 
</mule> 
+0

顯示您的XML配置,或者我們無法爲您提供幫助。一個IDE屏幕截圖是不夠的。 – 2013-04-23 17:10:49

+0

完成,請參閱編輯後。 – jonathanwiesel 2013-04-23 17:30:59

+0

「訪問上述端點時出現問題」< - 您如何訪問它? – 2013-04-23 19:02:47

回答

1

我在你的問題創造了命令一個密鑰(密碼爲1234561234太短)和部署你的配置(除了我刪除json:json-to-object-transformercomponent,因爲我沒有這個類)在Mule 3.4上,它的工作完美。

我可以curl -k https://localhost:8082/getProducts並得到答覆。所以一定有別的東西不會造成麻煩。

+0

試過,但仍然沒有運氣 – jonathanwiesel 2013-04-23 17:50:49

+1

我已經創建了一個密鑰庫與您的問題中的命令(密碼123456, 1234太短了),並部署你的配置(除了我刪除了'json:json-to-object-transformer'和'component',因爲我沒有這個類)在Mule 3.4上完美運行。我可以'curl -k https:// localhost:8082/getProducts'並獲得答覆。所以一定有別的東西不會造成麻煩。 – 2013-04-23 18:57:21

+0

有可能我的服務器沒有正確配置有效的SSL證書等的Tomcat? – jonathanwiesel 2013-04-23 19:02:10

0

我有這樣的例外: org.mule.exception.DefaultSystemExceptionStrategy:捕獲異常的異常處理策略:HTTP請求行格式有誤:(瘋狂的字符集caracters)

我滾,直到我意識到,我的HTTP服務是在https服務的相同端口。更改端口並再試一次,它適用於我。