1

I am using mule-4. I am trying to integrate a third-party API(confidential). It is working from the postman and is returning responses within 1 second. When I wrote a request connector for the same in mule, The API kept giving a timeout exception. I increased the response timeout to 2 minutes then also got the same error i.e. timeout exceeded. Please help.

EDIT 1:

I was able to reproduce this issue on postman. SO postman is adding Connection:keep-alive header by default and when this particular header is added then the API gives response within seconds but when this header is missing then the API gives a timeout error.

HMT
  • 2,093
  • 1
  • 19
  • 51

1 Answers1

1

You are not really providing too much details of the issue. I can give some generic guidelines:

  1. Ensure that there is network connectivity. If you are testing Postman and Mule from the same computer it is probably not an issue.
  2. Ensure host, port and certificates (if using TLS) are the same. Pointing an HTTPS request to port 80 could cause a timeout sometimes.
  3. Enable HTTP Wire logging in Mule and compare with Postman code as HTTP to identify any significant difference between the requests. For example: headers, URI, body should be the same, except probably for a few headers. Depends on the API. This is usually the main cause for differences between Postman and Mule, when the request are different.
aled
  • 21,330
  • 3
  • 27
  • 34
  • Thanks for your help ! 1. Computer is same 2. Host and port are same in mule and postman, TLS is not required 3. Headers, URI , body is same in both mule and postman . The API when hit from postman also appends cookies in the header. – HMT Dec 02 '21 at 17:03
  • I was able to reproduce this issue on postman. SO postman is adding Connection:keep-alive header by default and when this particular header is added then the API gives response within seconds but when this header is missing then the API gives a timeout error. Any suggestion on how to implement this on mule should I add connection:keep-alive in the headers of the request component ? – HMT Dec 02 '21 at 17:45
  • No, don´t try to add it manually. It is related to a feature of the HTTP the protocol called persistent connections. It should be enabled by default in the HTTP Request configuration (Use Persistent Connections see https://docs.mulesoft.com/http-connector/1.6/http-documentation#requestConfig_request). – aled Dec 02 '21 at 18:40