private static MessageProcessor newJaxWsComponentMessageProcessor(MuleContext muleContext,
Class<?> componentClass)
{
try
{
MessageProcessorBuilder wsmpb = (MessageProcessorBuilder) ClassUtils.instanciateClass("org.mule.module.cxf.builder.WebServiceMessageProcessorBuilder");
Method setServiceClassMethod = ClassUtils.getMethod(wsmpb.getClass(), "setServiceClass",
new Class<?>[]{Class.class});
setServiceClassMethod.invoke(wsmpb, componentClass);
Method setFrontendMethod = ClassUtils.getMethod(wsmpb.getClass(), "setFrontend",
new Class<?>[]{String.class});
setFrontendMethod.invoke(wsmpb, "jaxws");
((MuleContextAware) wsmpb).setMuleContext(muleContext);
return wsmpb.build();
}
catch (Exception e)
{
throw new MuleRuntimeException(
MessageFactory.createStaticMessage("Failed to configure the required web service infrastructure: are you missing the Mule CXF Module?"),