如何在Mule 3中构建一个简单的Web代理? [英] How to build a simple web proxy in Mule 3?
问题描述
我运行了这个Mule 3文件,希望当我浏览到http://localhost:9000
时,我将被重定向到http://localhost/path
(
I ran this Mule 3 file expecting that when I browse to http://localhost:9000
, I would be redirected to http://localhost/path
(source - behind a login prompt):
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.1/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd">
<pattern:web-service-proxy
name="WSProxyService"
inboundAddress="http://localhost:9000"
outboundAddress="http://localhost/sugarcrm"/>
</mule>
相反,我从网络浏览器收到此不友好的消息:
Instead, I get this unfriendly message from the web browser:
‹mO=OÃ0Ýó+ŽL0KÂÈX‚&ˆJ-DÂŒ×øÀ•ì8rÜJý÷8)bb9éî}Ü{â¢y[©Ï®…µÝ@÷ñ´Y¯ ¿F\·ê±QÍ©‹±}Íe&LtV äÓ÷Ѳ¼)+Øú#kè88xˆö$ðf²Øy}šõ•ü‡›®™¥2Ú÷—Î`h·P üõ›Ç{Dë{²ÆO§Ã7…>8Ì¥áÀIÇùOHƒ´
推荐答案
web-service-proxy模式旨在与SOAP样式的Web服务一起使用.将浏览器指向它对您没有任何好处.
The web-service-proxy pattern is designed to work with SOAP-style web services. Pointing your browser to it won't do you any good.
对于纯HTTP代理,要么:
For pure HTTP proxying either:
- 使用新模式:Mule 3.2中提供的http-proxy已在快照构建中使用(示例).
- use the new pattern:http-proxy coming in Mule 3.2 and already usable in snapshot builds (examples),
- use a pattern:bridge with HTTP in and out endpoints (examples).
如果您不反对快照,那么前者是一个更好的选择,因为它扩展了对HTTP请求语义的支持,并提供了即将到来的缓存模块.
The former is a much better option, if you're not snapshot averse, as it has extended support for HTTP requests semantics and an upcoming caching module.
这篇关于如何在Mule 3中构建一个简单的Web代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!