Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a simple web proxy in Mule 3?

Tags:

mule

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ƒ´
like image 379
tshepang Avatar asked Jul 01 '11 17:07

tshepang


2 Answers

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.

like image 194
David Dossot Avatar answered Sep 27 '22 23:09

David Dossot


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.

like image 41
Laci Kosco Avatar answered Sep 27 '22 23:09

Laci Kosco