Search code examples
apimuleesbmiddleware

ESB Mule - how to see the dynamic URL which is used to hit in the HTTP component


I am new to mule ESB.

I have designed a flow like below.

Mule flow

I like to see the request URL built dynamically to hit the REST API. I have tried debugging a flow. I have set a breakpoint on "Call_HTTPS_REST_API" http component. There i can see the payload. But URL i could not see any where.

Please help me to find the dynamic URL which is used to hit the service.

Note - I have tried using system.out.println to print the variable (dynamicEndpoint). Though i like to see the url which is used to hit the service.

Please find the flow configuration xml.

    <?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd">

<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8085" basePath="/mule" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="#[dynamicEndpoint]" port="443" doc:name="HTTP Request Configuration" protocol="HTTPS" >
    </http:request-config>
<flow name="secondflowFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <custom-transformer class="com.mule.URLBuilding.BuildURL" doc:name="Java"/>
<http:request config-ref="HTTP_Request_Configuration" method="POST" path="/" doc:name="Call_HTTPS_REST_API">
<http:success-status-code-validator values="0..599"/>
</http:request>
</flow>
</mule>

Solution

  • Just add a logger and log #[dynamicEndpoint]

    <logger message="#[dynamicEndpoint]" level="INFO" doc:name="Logger"/>
    

    If you create a variable you should see it in the debugger on the variables tab, at the moment you probably don't have a variable or maybe you create in in your Java code. Otherwise create a flowVars with the value #[dynamicEndpoint]