2
votes

I'm trying to make a flow that uses a HTTPS inbound endpoint.

So far I manage to do the following:

  • Create the keystore file by terminal with this command:

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

  • Placed the keystore.jks in my mule app src/main/resources directory

  • Created a global HTTPS connector with the following settings:

enter image description here

  • In my HTTP inbound endpoint checked the "Enable HTTPS" checkbox and selected my new global HTTPS connector as the connector reference.

My problem comes when accessing said endpoint in, lets say https://localhost:8082/getProducts

The browser throws this message

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.

And in my mule log I have the following:

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)

Probably I'm missing configuration steps either in server side or mule side.

I'll really appreciate the help.

Edit:

My XML ends up looking like 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>
2
Show your XML configuration or we can't help you. An IDE screenshot is not enough.David Dossot
Done, see edited post.jonathanwiesel
"My problem comes when accessing said endpoint" <- How do you access it?David Dossot
Initially by posting to it, but the error is present when pasting the URL on the browser and "curling" it toojonathanwiesel

2 Answers

1
votes

I've created a keystore with the command in your question (with password 123456, 1234 is too short) and deployed your configuration (except that I removed json:json-to-object-transformer and component, since I do not have the class) on Mule 3.4 and it works perfectly.

I can curl -k https://localhost:8082/getProducts and get a reply. So there must be something else you're not showing that causes trouble.

0
votes

I have this exception : org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: Http Request line is malformed: (crazy charset caracters)

I roll until I realise that my http services were in the same port of https services. Change the port and try again, it works for me.