PayloadRootSmartSoapEndpointInterceptor extends DelegatingSmartSoapEndpointInterceptor { @Override protected boolean shouldIntercept(WebServiceMessage request, Object endpoint) { try { QName payloadRootName = PayloadRootUtils.getPayloadRootQName(request.getPayloadSource(), transformerHelper); if (payloadRootName == null || !namespaceUri.equals(payloadRootName.getNamespaceURI())) { return false; } return !StringUtils.hasLength(localPart) || localPart.equals(payloadRootName.getLocalPart()); } catch (TransformerException e) { return false; } } PayloadRootSmartSoapEndpointInterceptor(EndpointInterceptor delegate, String namespaceUri, String localPart); void setTransformerHelper(TransformerHelper transformerHelper);  }
@Test public void shouldInterceptFullMatch() throws Exception { PayloadRootSmartSoapEndpointInterceptor interceptor = new PayloadRootSmartSoapEndpointInterceptor(delegate, namespaceUri, localPart); boolean result = interceptor.shouldIntercept(messageContext, null); assertTrue("Interceptor should apply", result); }
@Test public void shouldInterceptFullNonMatch() throws Exception { PayloadRootSmartSoapEndpointInterceptor interceptor = new PayloadRootSmartSoapEndpointInterceptor(delegate, "http: boolean result = interceptor.shouldIntercept(messageContext, null); assertFalse("Interceptor should not apply", result); }
@Test public void shouldInterceptNamespaceUriMatch() throws Exception { PayloadRootSmartSoapEndpointInterceptor interceptor = new PayloadRootSmartSoapEndpointInterceptor(delegate, namespaceUri, null); boolean result = interceptor.shouldIntercept(messageContext, null); assertTrue("Interceptor should apply", result); }
@Test public void shouldInterceptNamespaceUriNonMatch() throws Exception { PayloadRootSmartSoapEndpointInterceptor interceptor = new PayloadRootSmartSoapEndpointInterceptor(delegate, "http: boolean result = interceptor.shouldIntercept(messageContext, null); assertFalse("Interceptor should not apply", result); }