2013-07-12 2 views
0

Mule Studio에서 RSS 피드를 가져 오려고합니다. RSS 피드를 사용하고 CURL을 사용하여 브라우저에서이 피드를 볼 수 있지만 Mule 응용 프로그램으로는이 작업을 수행 할 수 없습니다. 이 Mule 응용 프로그램은 다른 RSS 피드와 작동하므로이 피드에 403 Forbidden 오류가 표시되는 이유를 알지 못합니다.Mule HTTP PollingConnector가 403을 반환하는 이유 Forbidden 일부 RSS 피드를 읽으려고 할 때 금지 된 오류

이 여기 내 뮬 흐름 XML

<http:polling-connector name="PollingHttpConnector" pollingFrequency="60000" doc:name="HTTP Polling" clientSoTimeout="10000" cookieSpec="netscape" receiveBacklog="0" receiveBufferSize="0" sendBufferSize="0" serverSoTimeout="10000" socketSoLinger="0" validateConnections="true"/> 
<flow name="mondavi" doc:name="mondavi"> 
    <http:inbound-endpoint exchange-pattern="one-way" doc:name=" " address="http://www.theaggie.org/feed/" connector-ref="PollingHttpConnector" encoding="UTF-8"/> 
    <logger message=" #[header:INBOUND:http.version] #[header:INBOUND:http.method] #[header:INBOUND:http.request] " level="INFO" category="mule.http.accesslog" doc:name="Logger"/> 
    <component class="edu.ucdavis.edustream.esb.news.rss.OrigFeedSplitter" doc:name="Java"/> 
    <foreach doc:name="For Each"> 
     <component class="edu.ucdavis.edustream.esb.news.rss.EntryReceiver" doc:name="Java"/> 
     <logger level="INFO" doc:name="Logger"/> 
     <http:outbound-endpoint exchange-pattern="request-response" host="${edus.host}" port="${edus.port}" path="api/v1/activity" method="POST" mimeType="application/json" doc:name="HTTP"/> 
    </foreach> 
</flow> 

만 헤더 요청을 성공적으로 CURL 요청의 응답입니다 :

HTTP/1.1 200 OK 
Date: Fri, 12 Jul 2013 19:06:51 GMT 
Server: Apache 
Set-Cookie: PHPSESSID=l0eg8e93ihb3r65plms64l84f7; path=/ 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
X-Pingback: http://www.theaggie.org/xmlrpc.php 
Last-Modified: Fri, 12 Jul 2013 03:37:00 GMT 
ETag: "556af474b6fdedb235c46e19926f69db" 
Content-Type: text/html; charset=UTF-8 

답변

2

http://www.theaggie.org/feed/은 사용자 에이전트는 "자카르타 때 HTTP 가져 거부를 Commons-HttpClient/3.1 ", Mule이 사용하는 것입니다.

 
$ curl -I -H "User-Agent: Jakarta Commons-HttpClient/3.1" http://www.theaggie.org/feed/ 
HTTP/1.1 403 Forbidden 
Date: Fri, 12 Jul 2013 19:27:20 GMT 
Server: Apache 
Status: 403 Forbidden 
Connection: Close 
Content-Type: text/html; charset=UTF-8 
+0

고마워요! 피드를받을 수 있으려면 Mule의 User-Agent를 어떻게 변경할 수 있는지 알고 있습니까? – Emm

+1

에헴, 사용자 에이전트에 대한 속임수를 쓰는 것은 나쁜 습관이라고 생각합니다 ... 이상하게도 우리는이 녀석들에게 빨기를 멈추라고 요청해야합니다. 덜 이상적인 세계에서, 나는 간단하게 엔드 포인트 주소로'http : //www.theaggie.org/feed/? User-Agent = MuleESB'를 사용할 수 있다고 말할 수 있습니다. 그러나 다시, 그것은 나쁜 연습 일 것이다 :) –