Reputation: 443
I have a simple REST HTTPS GET, the uri of it is like that:
https://mytest.test:443/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
which works perfectly to run in a browser, Postman, etc. With Mule 3.8 HTTP I select the uri from the RAML generataed specification, set uri-param and still I am getting an exception :
DEBUG 2016-06-28 16:38:35,321 [[svc0014_loyalty].http.requester.ODP_Request_Configuration(1) SelectorRunner] com.ning.http.client.providers.grizzly.AsyncHttpClientFilter: REQUEST: HttpRequestPacket (
method=GET
url=/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
query=null
protocol=HTTP/1.1
content-length=-1
headers=[
Host=correct.host:443
User-Agent=AHC/1.0
Connection=keep-alive
Accept=*/*]
)
DEBUG 2016-06-28 16:38:35,322 [[svc0014_loyalty].http.requester.ODP_Request_Configuration(1) SelectorRunner] org.mule.module.http.internal.HttpMessageLogger: REQUESTER
GET /nccpointshop/REST/giftcard/giftcards/list/currency/SEK HTTP/1.1
Host: correct.host:443
User-Agent: AHC/1.0
Connection: keep-alive
Accept: */*
DEBUG 2016-06-28 16:38:35,498 [[svc0014_loyalty].http.requester.ODP_Request_Configuration.worker(8)] com.ning.http.client.AsyncCompletionHandlerBase: Remotely closed
java.io.IOException: Remotely closed
DEBUG 2016-06-28 16:38:35,520 [[svc0014_loyalty].svc0014_loyalty-httpListenerConfig.worker.02] com.mulesoft.mule.debugger.server.DebuggerMuleNotificationHandlerImpl: MESSAGE_PROCESSOR_POST_INVOKE -> Path /get:\/giftcards:svc0014_loyalty-config/processors/2
DEBUG 2016-06-28 16:38:37,327 [[svc0014_loyalty].Mule.01] com.mulesoft.mule.debugger.server.DebuggerMuleNotificationHandlerImpl: Notification 2001 was received ef4625b0-3d3d-11e6-998f-448500a727fa
ERROR 2016-06-28 16:38:37,329 [[svc0014_loyalty].svc0014_loyalty-httpListenerConfig.worker.02] org.mule.module.apikit.MappingExceptionListener:
********************************************************************************
Message : Error sending HTTP request. Message payload is of type: NullPayload
Type : org.mule.api.MessagingException
Code : MULE_ERROR-29999
Payload : {NullPayload}
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
********************************************************************************
Exception stack is:
1. Remotely closed (java.io.IOException)
2. java.io.IOException: Remotely closed (java.util.concurrent.ExecutionException)
org.glassfish.grizzly.impl.SafeFutureImpl$Sync:349 (null)
3. java.util.concurrent.ExecutionException: java.io.IOException: Remotely closed (java.io.IOException)
org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient:245 (null)
4. Error sending HTTP request. Message payload is of type: NullPayload (org.mule.api.MessagingException)
org.mule.module.http.internal.request.DefaultHttpRequester:287 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
********************************************************************************
Root Exception stack trace:
java.io.IOException: Remotely closed
********************************************************************************
I am attaching a picture of how my configuration looks like
Upvotes: 2
Views: 14564
Reputation: 443
The thing with Mule HTTP connector is that it adds host and port from the associated configuration always as a header: headers=[ Host=correct.host:443
Some systems do not allow that, they do not accept adding the port (in our case the port is dynamically allocated in the backend system). So, this request: https://correct.host:443/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
is invalid, but this one is valid: https://correct.host/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
This is hard to notice and catch, as Postman and Chrome will both send correct requests. I recommend using some other tool like SoapUI (I noticed it with it). However, there is a way to overwrite the value for the "Host" in the headers like this:
<http:request config-ref="HTTP_Request_Configuration1" path="/nccpointshop/REST/giftcard/giftcards/list/currency/SEK" method="GET" doc:name="Copy_of_HTTP">
<http:request-builder>
<http:header headerName="Host" value="correct.host"/>
</http:request-builder>
</http:request>
Upvotes: 4