title: WSO2 ESB - HTML Response
body: <p>I built a GET REST webservice (Rest API) which has to return text/html.
  Inside the sequence I have a Mediator where I invoke a webpage (like <a href="http://www.mypage.com" rel="nofollow">http://www.mypage.com</a> or something), and get its contents into a String variable. 
  <br/>After that I need to do some string replacements in the content and send it back as text/html to the client.
  <br/>The problem is that when I got it back in my page the esb has replaced all <code>&lt;html&gt;</code> and other tags to <code>&amp;lt;html&amp;gt;</code> tags. So the web browser does not render a html page, but just writes the tags in the page itself.</p>
  
  <p>The main idea is that it works like a proxy to a servlet, where I call a servlet, get the response, do some string replacements inside de html and javascript that I got, and send it to client.</p>
  
  <p>Here is the sequence xml:</p>
  
  <pre><code> &lt;resource methods="GET" uri-template="/view"&gt;
    &lt;inSequence&gt;
       &lt;log level="full"/&gt;
       &lt;header name="To" action="remove"/&gt;
       &lt;property name="URL" value="http://www.mypage.com"/&gt;
       &lt;sequence key="MyMediator"/&gt;
       &lt;property name="RESPONSE" value="true"/&gt;
       &lt;property name="NO_ENTITY_BODY" scope="axis2" action="remove"/&gt;
       &lt;property name="ContentType" value="text/html" scope="axis2"/&gt;
       &lt;enrich&gt;
          &lt;source type="property" clone="true" property="RESPONSE_MSG"/&gt;
          &lt;target type="body"/&gt;
       &lt;/enrich&gt;
       &lt;send/&gt;
    &lt;/inSequence&gt;
  </code></pre>
  
  <p></p>
  
  <p>So, I put the string variable with the html (got from the mediator MyMediator, which is a java class and invoke the webpage www.mypage.com) into a property 'RESPONSE_MSG' and then try to write it to the body (enrich). </p>
  
  <p>In this case I get an error, because the property I set is a String and not a XML. <br/>If I use a payloadFactory instead of an enrich, then it will generate an XML and I will get the html tags with <code>&amp;lt;html&amp;gt;</code>.</p>
  
  <p>I would like to know an effective way where I can send the string variable from the mediator and it does not get transformed into some xml where all the html tags into the string gets replaced by <code>&amp;lt;</code> and <code>&amp;gt;</code>. Or I can send it like in the above code without getting any error. Do I have to use another type for the variable that I put in the property RESPONSE_MSG?</p>
  
  <p>Thanks in advance!</p>