1

我有一个肥皂服务流,它通过<cxf:proxy-service>. 我有一个 java 组件在它之后获取有效负载作为字符串。

这是我的流程:

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

这是我的 GetPayload 类:

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

我需要一种方法来摆脱 GetPayload 类并在我的mule-config. 我试过了 <object-to-string-transformer/>

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

message.payloadAsString抛出异常。我不明白为什么。

4

1 回答 1

4

利用:#[message.payloadAs(java.lang.String)]

来自: http: //www.mulesoft.org/documentation/display/current/MEL+Cheat+Sheet#MELCheatSheet-PayloadandAttachments

于 2013-06-19T17:06:25.077 回答