How to build a simple web proxy in Mule 3?

╄→гoц情女王★ 提交于 2019-12-23 10:01:25

问题


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ƒ´

回答1:


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.

For pure HTTP proxying either:

  • 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).

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.




回答2:


I've had a similar problem, although I used soapUI to perform the test. The solution after some days getting lost is simple, configure soapUI not to use/don't allow compression. What you see is actually compressed answer that server did not mark as compressed.



来源:https://stackoverflow.com/questions/6551496/how-to-build-a-simple-web-proxy-in-mule-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!