Mule ESB:阅读HTML [英] Mule ESB : Read HTML
问题描述
我遇到了必须解析网页结果的情况.在这种情况下,网站不提供用于检索此数据的API.我创建了一个调用网站的流程,但声明:
I have a situation where I have to parse the result of a webpage. In this case, the website does not offer an API to consume to retrieve this data. I have created a flow that calls the website but states:
消息:发送HTTP请求时出错.消息有效负载的类型为:NullPayload
任何帮助将不胜感激.
Message: Error sending HTTP request. Message payload is of type: NullPayload
Any help would be much appreciated.
<http:request-config name="HTTP_Request_Configuration" host="http://www.resellerratings.com/" port="80" doc:name="HTTP Request Configuration" basePath="/"/>
<flow name="testFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/testReseller" allowedMethods="GET" doc:name="HTTP"/>
<http:request config-ref="HTTP_Request_Configuration" path="/store/best_buy" method="GET" doc:name="HTTP" sendBodyMode="NEVER"/>
<logger message="#[message]" level="INFO" doc:name="Logger"/>
</flow>
推荐答案
鉴于您的配置,它可能由于host属性而失败,因为它不应该包含协议.尝试以下方法:
Given your configuration, it probably fails because of the host attribute since it shouldn't include the protocol. Try this instead:
<http:request-config name="HTTP_Request_Configuration" host="www.resellerratings.com" port="80" doc:name="HTTP Request Configuration" />
<flow name="testFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/testReseller" allowedMethods="GET" doc:name="HTTP"/>
<http:request config-ref="HTTP_Request_Configuration" path="/store/best_buy" method="GET" doc:name="HTTP" sendBodyMode="NEVER"/>
<logger message="#[message]" level="INFO" doc:name="Logger"/>
</flow>
<http:request-config name="HTTP_Request_Configuration" host="www.resellerratings.com" port="80" doc:name="HTTP Request Configuration" />
<flow name="testFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/testReseller" allowedMethods="GET" doc:name="HTTP"/>
<http:request config-ref="HTTP_Request_Configuration" path="/store/best_buy" method="GET" doc:name="HTTP" sendBodyMode="NEVER"/>
<logger message="#[message]" level="INFO" doc:name="Logger"/>
</flow>
这篇关于Mule ESB:阅读HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!