*/
private MessageProcessor createMessageProcessor() throws MuleException
{
MessageProcessorChainBuilder chainBuilder = new DefaultMessageProcessorChainBuilder();
chainBuilder.chain(new AbstractInterceptingMessageProcessor()
{
@Override
public MuleEvent process(MuleEvent event) throws MuleException
{
try
{
/* If the requestBody variable is set, it will be used as the payload to send instead
* of the payload of the message. This will happen when an operation required no input parameters. */
if (requestBody != null)
{
event.getMessage().setPayload(requestBody);
}
copyAttachmentsRequest(event);
MuleEvent result = processNext(event);
copyAttachmentsResponse(result);
return result;
}
catch (DispatchException e)
{
/* When a Soap Fault is returned in the response, CXF raises a SoapFault exception.
* We need to wrap the information of this exception into a new exception of the WS consumer module */
if (e.getCause() instanceof SoapFault)
{
SoapFault soapFault = (SoapFault) e.getCause();
event.getMessage().setPayload(soapFault.getDetail());
throw new SoapFaultException(event, soapFault.getFaultCode(), soapFault.getSubCode(),
soapFault.getMessage(), soapFault.getDetail());
}
else
{
throw e;
}
}
}
});
// Add a message processor that removes the invocation property CxfConstants.OPERATION if present
// (as it may change the behavior of CXF proxy client). It is added again after executing the proxy client.
chainBuilder.chain(new AbstractInterceptingMessageProcessor()
{
@Override
public MuleEvent process(MuleEvent event) throws MuleException
{
Object operation = event.getMessage().removeProperty(CxfConstants.OPERATION, PropertyScope.INVOCATION);
MuleEvent result = processNext(event);
if (operation != null)
{
result.getMessage().setInvocationProperty(CxfConstants.OPERATION, operation);
}
return result;
}
});
chainBuilder.chain(createCxfOutboundMessageProcessor(config.getSecurity()));
chainBuilder.chain(new AbstractInterceptingMessageProcessor()
{
@Override
public MuleEvent process(MuleEvent event) throws MuleException
{
// Remove outbound properties that are mapped to SOAP headers, so that the