Emm
Emm

Reputation: 79

403 Forbidden error Mule using http outbound endpoint

I am trying to poll an RSS feed using Mule Studio but have been unsuccessful polling the information using the http outbound-endpoint in the Mule application. I have previously encountered the same issue using the http inbound-endpoint with the same site but was able to resolve the issue by assigning the User-Agent to MuleESB by setting the address to be

http://www.theaggie.org/feed/?User-Agent=MuleESB

However, now with the http outbound-endpoint, I am unable to poll the feed and get a 403 Forbidden error. My XML for the flow is

    <flow name="aggregatorFlow1" doc:name="aggregatorFlow1">
        <poll>
            <processor-chain>
                 <set-variable variableName="httpMessages" value="#[[]]" />
                 <http:outbound-endpoint exchange-pattern="one-way" address="http://www.theaggie.org/feed/?User-Agent=MuleESB" method="GET" />
                 <expression-component>httpMessages.add(message.payloadAs(java.lang.String))</expression-component>
            </processor-chain>
        </poll>
        <logger level="INFO" message="#[httpMessages]" />
    </flow> 

If I change the exchange-pattern to request-response, the logger would just output [ ]. I do not have issues with other sites using the same xml code.

Upvotes: 1

Views: 2523

Answers (1)

David Dossot
David Dossot

Reputation: 33413

Clearly the exchange-pattern should be request-response, as you seem to care about the payload of the response.

Try adding the following before the http:outbound-endpoint:

<set-property propertyName="User-Agent" value="MuleESB" />

Upvotes: 1

Related Questions