XPathPayloadEndpointMapping extends AbstractMapBasedEndpointMapping implements InitializingBean { @Override protected String getLookupKeyForMessage(MessageContext messageContext) throws Exception { Element payloadElement = getMessagePayloadElement(messageContext.getRequest()); return expression.evaluateAsString(payloadElement); }  void setExpression(String expression); void setNamespaces(Map<String, String> namespaces); @Override void afterPropertiesSet();  }
@Test public void testGetLookupKeyForMessage() throws Exception { mapping.setExpression("/root/text()"); mapping.afterPropertiesSet(); MockWebServiceMessage request = new MockWebServiceMessage("<root>value</root>"); MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory()); String result = mapping.getLookupKeyForMessage(context); Assert.assertNotNull("mapping returns null", result); Assert.assertEquals("mapping returns invalid result", "value", result); }