问题
Im getting connection timeout error in Mule(anypoint studion), when invoking a request.
I have added dummy url(for testing purpose) in an http request flow. That dummy url is working fine with postman and soaupui. But not from Mule.
I get,
Message : HTTP GET on resource 'http://xxx:3080/hr/INT053' failed: Connection timed out: no further information.
Error type : HTTP:CONNECTIVITY
if i invoke http://xxx:3080/hr/INT053
directly from postman/soapui it works.
What might be the cause? I have provided enough time for connection timeout
<http:request-config name="SIRequest" doc:name="HTTP Request configuration" doc:id="1762b766-b6b7-41f2-9298-3680fcd9f6bb" responseTimeout="300000">
<http:request-connection connectionIdleTimeout="0" host="xxx" port="3080">
</http:request-connection>
</http:request-config>
Edit
I have enabled wire log. also, i have added host header, responseStreamingMode="NEVER" attributes too. but same issue I dont get request log printed in console log.
******************************************************************************************************
* - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - *
*******************************************************************************************************
* delwp-api-mule-hr-admin-api-v1 * default * DEPLOYED *
*******************************************************************************************************
DEBUG 2020-03-06 12:05:46,047 [http.listener.02 SelectorRunner] [event: ] org.mule.service.http.impl.service.HttpMessageLogger: LISTENER
GET /yyy/people-and-organisation/hr-and-administration/v1.0/employees?lastmodifieddatetime=2020-02-03T12:00:00 HTTP/1.1
User-Agent: PostmanRuntime/7.22.0
Accept: */*
Cache-Control: no-cache
Postman-Token: 8e92c1b2-98d1-49d1-ad48-f2334c80bce6
Host: localhost:8085
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
ERROR 2020-03-06 12:06:16,032 [[admin-api-v1].http.requester.SAPCPIRequest.01 SelectorRunner] [event: ] org.mule.extension.http.internal.request.HttpRequester: Error sending HTTP request to http://xx:3080/hr/INT053
ERROR 2020-03-06 12:06:16,098 [[admin-api-v1].http.requester.SAPCPIRequest.01 SelectorRunner] [event: ] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler:
********************************************************************************
Message : HTTP GET on resource 'http://xxx:3080/hr/INT053' failed: Connection timed out: no further information.
Error type : HTTP:CONNECTIVITY
Element : sys-sap:\get-employees-data-sub-flow/processors/1/processors/0 @ admin-api-v1:sys/sys-sap.xml:111 (HTTP GET SAP Employees Data Rest API)
Element XML : <http:request method="GET" doc:name="HTTP GET SAP Employees Data Rest API" doc:id="9a903527-03de-405b-b525-0276293db6ea" config-ref="SAPCPIRequest" path="/hr/INT053">
<http:query-params>#[output application/java
---
{
"lastmodifieddatetime" : vars.lastModifiedDateTime
}]</http:query-params>
</http:request>
(set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
ERROR 2020-03-06 12:06:16,155 [[MuleRuntime].cpuLight.05: [admin-api-v1].impl-employees:\get-employees-data-flow.CPU_LITE @e699215] [event: 0-9c3ca130-5f46-11ea-a536-d481d74cc715] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler:
********************************************************************************
Message : HTTP GET on resource 'http://xxx:3080/hr/INT053' failed: Connection timed out: no further information.
Error type : HTTP:CONNECTIVITY
Element : raml-main/processors/1 @ admin-api-v1:api.xml:19
Element XML : <apikit:router config-ref="raml-config"></apikit:router>
(set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
....
..
回答1:
Take a look at this troubleshooting guide for HTTP. There are a number of reasons why you might be seeing that difference, usually it comes down to the Host
header issue (Mule adds the port to it which is valid but many servers cannot handle) or an encoding issue (Mule often uses chunked encoding but some servers cannot handle it).
The easiest way to check what the problem might be is to enable wire logging in Mule, as explained on that guide, and see the actual request being sent with headers and all. You can then compare that to Postman or curl are sending.
来源:https://stackoverflow.com/questions/60538226/get-call-works-for-postman-soapui-but-not-at-mule-4-1-3