SoapMethodArgumentResolver implements MethodArgumentResolver { @Override public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) { Assert.isInstanceOf(SoapMessage.class, messageContext.getRequest()); SoapMessage request = (SoapMessage) messageContext.getRequest(); Class<?> parameterType = parameter.getParameterType(); if (SoapMessage.class.equals(parameterType)) { return request; } else if (SoapBody.class.equals(parameterType)) { return request.getSoapBody(); } else if (SoapEnvelope.class.equals(parameterType)) { return request.getEnvelope(); } else if (SoapHeader.class.equals(parameterType)) { return request.getSoapHeader(); } throw new UnsupportedOperationException(); }  @Override boolean supportsParameter(MethodParameter parameter); @Override Object resolveArgument(MessageContext messageContext, MethodParameter parameter);  }
@Test public void resolveSoapMessageSaaj() throws Exception { MessageContext messageContext = createSaajMessageContext(); Object result = resolver.resolveArgument(messageContext, soapMessageParameter); assertEquals(messageContext.getRequest(), result); }
@Test public void resolveSoapEnvelopeSaaj() throws Exception { MessageContext messageContext = createSaajMessageContext(); Object result = resolver.resolveArgument(messageContext, soapEnvelopeParameter); assertEquals(((SoapMessage) messageContext.getRequest()).getEnvelope(), result); }
@Test public void resolveSoapBodySaaj() throws Exception { MessageContext messageContext = createSaajMessageContext(); Object result = resolver.resolveArgument(messageContext, soapBodyParameter); assertEquals(((SoapMessage) messageContext.getRequest()).getSoapBody(), result); }
@Test public void resolveSoapHeaderSaaj() throws Exception { MessageContext messageContext = createSaajMessageContext(); Object result = resolver.resolveArgument(messageContext, soapHeaderParameter); assertEquals(((SoapMessage) messageContext.getRequest()).getSoapHeader(), result); }