1
votes

I've a soap service flow which gets inbound request through <cxf:proxy-service>. I have a java component right after it to get payload as String.

Here is my flow:

<flow name="soapService">
    <http:inbound-endpoint address="${service.address}" exchange-pattern="request-response">
        <cxf:proxy-service wsdlLocation="classpath:service.wsdl" namespace="http://pennmutual.com/services/mvi" service="MVIService" enableMuleSoapHeaders="false"/>                
    </http:inbound-endpoint>        
    <component class="test.GetPayload" />
  .
  .
  .
 </flow>

And here is my GetPayload class:

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;
}

I need a way to get rid of GetPayload class and do same thing in my mule-config. I tried <object-to-string-transformer/>

and <set-payload value="#[message.payloadAsString]"/>

but message.payloadAsString throws exception. I don't understand why.

1

1 Answers