MarshallingPayloadMethodProcessor extends AbstractPayloadMethodProcessor { @Override public void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue) throws Exception { if (returnValue == null) { return; } Marshaller marshaller = getMarshaller(); Assert.state(marshaller != null, "marshaller must not be null"); if (logger.isDebugEnabled()) { logger.debug("Marshalling [" + returnValue + "] to response payload"); } WebServiceMessage response = messageContext.getResponse(); MarshallingUtils.marshal(marshaller, returnValue, response); } MarshallingPayloadMethodProcessor();  MarshallingPayloadMethodProcessor(Marshaller marshaller);  MarshallingPayloadMethodProcessor(Marshaller marshaller, Unmarshaller unmarshaller); Marshaller getMarshaller(); void setMarshaller(Marshaller marshaller); Unmarshaller getUnmarshaller(); void setUnmarshaller(Unmarshaller unmarshaller); @Override Object resolveArgument(MessageContext messageContext, MethodParameter parameter); @Override void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue);  }
@Test public void handleReturnValue() throws Exception { MyObject returnValue = new MyObject(); marshaller.marshal(eq(returnValue), isA(Result.class)); replay(marshaller, unmarshaller); MessageContext messageContext = createMockMessageContext(); processor.handleReturnValue(messageContext, supportedReturnType, returnValue); verify(marshaller, unmarshaller); }