Search code examples
configurationmulehttprequestanypoint-studio

How to configure "HTTP_request_configuration" in Anypoint Studio?


I am using Anypoint 6.2.3 and I am trying to call an api baconipsum.com/api/?type=meat-and-filler for that, my project flow is

<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9000" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="baconipsum.com"  doc:name="HTTP Request Configuration" basePath="api" port="8081"/>
<flow name="test2Flow1" >
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <http:request config-ref="HTTP_Request_Configuration" path="/" method="GET" doc:name="HTTP" >
      <http:request-builder>
            <http:query-param paramName="type" value="#[message.inboundProperties.'http.query.params'.type]"/>
            <http:query-param paramName="sentences" value="#[message.inboundProperties.'http.query.params'.sentences]"/>
        </http:request-builder>
    </http:request>
  <file:outbound-endpoint path="C:/Users/arpit_jain2/Desktop/Response" outputPattern="res.json" responseTimeout="10000" doc:name="File"/>
</flow>

and the HTTP_Request_Configuration is

HTTP_Request_Configuration

In the documentation of MuleSoft, port number is not assigned and it is working fine but when I implement the same configuration I get the error.

Value for port must be provided

Does anyone know what should be the port and why I am getting null payload error.

Error while calling the API
Am I missing something in the Anypoint configuration or in the HTTP_Request_Configuraion?


Solution

  • Default port for http is 80. So set port="80"

    You have set to 8081 and http://baconipsum.com/api/?type=meat-and-filler is listening on 80(default) not 8081