title: How to write Mule muleEventContext.getMessage().getPayloadAsString() in MEL in mule-config
body: <p>I've a soap service flow which gets inbound request through <code>&lt;cxf:proxy-service&gt;</code>. I have a java component right after it to get payload as String.</p>
  
  <p>Here is my flow:</p>
  
  <pre><code>&lt;flow name="soapService"&gt;
      &lt;http:inbound-endpoint address="${service.address}" exchange-pattern="request-response"&gt;
          &lt;cxf:proxy-service wsdlLocation="classpath:service.wsdl" namespace="http://pennmutual.com/services/mvi" service="MVIService" enableMuleSoapHeaders="false"/&gt;                
      &lt;/http:inbound-endpoint&gt;        
      &lt;component class="test.GetPayload" /&gt;
    .
    .
    .
   &lt;/flow&gt;
  </code></pre>
  
  <p>And here is my GetPayload class:</p>
  
  <pre><code>public Object onCall(MuleEventContext eventContext) throws Exception {
      String requestXml = null;
      try {
  
          requestXml = eventContext.getMessage().getPayloadAsString();
          logger.debug("Request XML " + requestXml);
  
      } catch (Exception e) {
          e.printStackTrace();
      }
      return requestXml;
  }
  </code></pre>
  
  <p>I need a way to get rid of GetPayload class and do same thing in my <code>mule-config</code>. I tried 
  <code>&lt;object-to-string-transformer/&gt;</code></p>
  
  <p>and
  <code>&lt;set-payload value="#[message.payloadAsString]"/&gt;</code></p>
  
  <p>but <code>message.payloadAsString</code> throws exception. I don't understand why.</p>